I have two event handlers:
$('body').on('click','.saveField',function(){
var id = $(this).attr('id');
alert($(this).attr('class'));
id = id.split("_");
id = id[0];
$('#'+id).trigger('click');
});
$('body').on('click','.nav',function(){
var id = $(this).attr('id');
alert('I triggered');
$.ajax({
type:"POST",
data:"id="+id,
url:"getServiceData.php",
success:function(result){
$('#pageBody').html(result);
}
});
});
Much deeper into the page I have:
<img src='../images/saveIcon.png' width='25px' id='".$id."_save_".$field."' class='saveField'>
The .nav
event handler is being fired by clicking on the above image. My question is where should I be looking to find out why?
This is what I know:
1) The class given by the first is only saveField
2) I have searched through pages to look for a missing quote somewhere, I think this is the cause, but I am not sure.
3) Here is the odd thing. The img src is 1 of many. Only the first instances fires the .nav
class event. img src's 2-10 fire the saveField
event as expected...
Is this likely some syntax missing a quote/comma/etc. somewhere?