Hello i have a script
<script>
$(document).ready(function() {
test();
jQuery('#bf_dishes > li > a').live('click', function(e) {
alert('HI');
i=1;
var kitchenname=$(this).parent('li').index();
$('.bf_gallery_item').each(function() {
image="kitchen"+kitchenname+"/"+i+".jpg";
//alert($(this).find('img').attr('data-bgimg'));
//alert($(this).find('img').data('bgimg'));
$(this).find('img').attr('data-bgimg',image);
$(this).find('img').attr('src',image);
i++;
});
test();
});
});
</script>
Now on ready my test function is executing but i have same click event within test function
function test() {
jQuery('#bf_dishes > li > a').live('click', function(e) {
// dosomeythisng;
});
}
but when i click on bf_dishes it runs that event which is in test function. i want to execute previous click event .
Thanks
you can trigger
'#bf_dishes > li > a'clickfunction fromtest()but it will lead to a infinite loop . an also i think you can’t define two click events for the same element in two places ,http://api.jquery.com/trigger/