<div id="display">
<div align="left" class="display_box">
<a class="test" href="#">
<img style="width:25px; float:left; margin-right:6px" src="user_img/gow.jpg">
</a>
<input type="hidden" id="uid" value="3">
<b>b</b>ack <b>b</b>ack<br>
<span style="font-size:9px; color:#999999">back</span>
</div>
<div align="left" class="display_box">
<a class="test" href="#">
<img style="width:25px; float:left; margin-right:6px" src="user_img/gow.jpg">
</a>
<input type="hidden" id="uid" value="3">
<b>b</b>ack <b>b</b>ack<br>
<span style="font-size:9px; color:#999999">back</span>
</div>
</div>
I am making this auto complete search function with images in thumbnail like facebook and getting this as html after ajax call .
what i want to do is that if user clicks on any div with class display_box i want to get the value of hidden field in the div…
I tried this code but its not capture click event how ever if I use #display click event capturing but that is for whole div.
$('.display_box').click(function() {
var id =$(this).find('input[type=hidden]').val();
});
Finally found out the problem actually it was binding the click event with displaybox but there is no existence of display box when program runs initially or until u search so what i did is i bind the click event in success of ajax call and now its working … I hope it helps. actually these divs display_box are dynamically made when user search something coming from database here is the complete code for help to any one