Im generating a dynamic list in jqueury, and when clicked i need to get the specific value of the hidden fields in THAT list element, but i am struggling.
<li class="trigger">
<a class="" href="#">Aktiv</a>
<input name="hrDesc" value='Value 1'>
<input name="hrCount" value="Value 2">
</li>
<li class="trigger`">
<a class="" href="#">Uaktiv</a>
<input name="hrDesc" value="Value 3">
<input name="hrCount" value="Value 4">
</li>
Here is my jquery:
$('.trigger').live( "click", function(){
alert ( $("[name='hrDesc']").serialize() );
});
The problem is that is always returns all values of “hrDesc”
Any help would be greatly appreciated.
Note
Instead of
.live()try to use.on()for delegate event handling with jQuery 1.7+