i have the following problem using jquery.
I have sth like this
<div id="yxz" value="1">
<span class="delete"></span>
</div>
now I have this fn but it only returns “undefined”, it does however return the id, or class if I ask for this.
$(".delete").click(function(){
alert($(this).parent("div").attr("value"));
});
I used to get this value with the same attr stuff. Does this have sth to do with me using the jquery 1.6.1 now instead of 1.5.2.
Thanks for your help.
To retrieve the value of elements, use val(). Since divs don’t have values, you should use data() to set and get data.