Alx wrote:
> hello again)
>
> 1) i just wanted to know is it possible to get element's attributes in
> hash or array?
> for example something like this:
> <span style="color:red;" id="myEl" onclick="alert(1)">
> ..
> $('myEl').attibutes().length // == 3
>
>
I don't see a built-in method. If you loop through an element using
for-in or $H(element).inspect() you'll notice a lot of browser-specific
attributes that may not mean anything to you. So the question is, with
which attributes are you concerned? Then, just make a function that
looks for those. But be aware that even if style is not defined in the
HTML, it is still a property of the element. So you may need a regex
that looks at innerHTML get what you need.
> 2) is there any analogues of php functions var_dump() and print_r()
> for Objects/Hashes and Arrays?
>
inspect() is probably what you need.
- Ken Snyder
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---