Get div attributes via Hpricot
I've got a spec开发者_开发百科ific div id called progress_bar ()
And I'm trying to retrieve just the width of the div. I'm fairly new to Ruby and Hpricot so any help would be greatly appreciated.
Cheers, Scott
As long as the width attribute is set in the HTML something like this should work according to the docs:
doc = Hpricot("my html")
(doc/"#progress_bar")['width']
Found here: https://github.com/hpricot/hpricot
加载中,请稍侯......
精彩评论