Saturday, 15 March 2014

javascript - Jquery click function fire multiple time with Jquery load -



javascript - Jquery click function fire multiple time with Jquery load -

i have 1 custom function

(function($) { $.fn.customcheck = function(options) { this.each(function() { // }); $('span.check').click(function(){ alert('ok'); }); }; }(jquery));

normally function working

function show_conversation(url){ var $container = $('section.load'); $container.html('<span class="loading">loading</span>'); $container.load(url,function(){ //my check box function not working dynamically loaded content //so want phone call function 1 time again //but action fire multiple times (click) $('input[type="checkbox"]').customcheck(); }); } $(document).ready(function(){ $('input[type="checkbox"]').customcheck(); var url = 'test.html'; show_conversation(url); $('a').click(function(){ var url = $(this).attr('href'); show_conversation(url); }); });

but function not working in dynamically loaded content. want phone call function 1 time again within load function. in custom function have 1 click function. thats why click function run multiple times.

you can check total code here http://pastebin.com/6nczuszd . how can avoid error. there alternative without move click event custom function? sorry bad english.

javascript jquery

No comments:

Post a Comment