[jQuery] newbie question about assigning a varialbe for use in a selector statement
I have a form with the following (there are about 20 of these; you can
assume that the id value goes up to 706):
<input id="686" class="add_image" type="button" value="add image"/>
add image 2
and beneath it would like to have a form element that is normally
hidden:
<div class="add_image_content 686" >hello in add_image_content</div>
Basically, I'd like to be able to access the e.targed.id and then use
it in a selector to select div's that have 'add_image_content' and the
associated id value.
My javascript is:
$(document).ready(function(){
$('.add_image_content').hide();
$('.add_image').bind('click',function(e){
//alert(e.target.id);
var $val=e.target.id;
$(div:contains($val)).show();
//didn't work
//$('.add_image_content' + e.target.id).show();
//$(e.target.id).show();
});
});
thanks for any help,
jt