Donny Kurnia schrieb:
> I've got this result while debugging with firebug:
> 
>>>> $("type",line)
> [<type value="select">]
>>>> $("type",line).attr("value")
> --result nothing
>>>> $("type",line).get(0)
> <type value="select">
>>>> $("type",line).get(0).attr("value")
> --result nothing
> 
> How do I got the value attribute from $("type",line) without assign it
> to another variable?
> Why chainable method didn't work for $().get() ??


Because there is no type element in HTML, I assume you process XML here. 
Do you have the proper MIME type set for that?

For XML I'd use getAttribute because val() is shorthand for HTML's value 
attribute and I'm not sure if it works in XML.

I would stick to the traditional DOM methods:

$("type",line)[0].getAttribute("value");

get(0) or the shorthand [0] breaks the chain, because it returns the 
true DOM node you are working with, thus you cannot apply jQuery methods 
anymore.


-- Klaus



_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to