JQuery.attr returns user attribute return undefined
I have the following problem using jquery.
It seems to me like
<div id="yxz" value="1"> <span class="delete"></span> </div> I now have fn, but it only returns “undefined”, however it returns an identifier or class if I ask for it.
$(".delete").click(function(){ alert($(this).parent("div").attr("value")); }); I used this value with the same attr attribute. This has to do with me using jquery 1.6.1 instead of 1.5.2.
Thank you for your help.
+8
Lukas Oppermann
source share5 answers
I can confirm that this piece of code works fine in Chrome 11, Firefox 4 and IE 9 using the jQuery Git version.
EDIT: for those advising prop (), check out the docs . Prop () is used for boolean attributes such as: checked, disabled, etc.
+4
Melvin
source share