dom - Jquery fade in / out looping more than once -


i've been using jquery image swapping , fading.

i have div, , id of cup-builder-error

i use jquery load images divs, on error fade in , out error div

$("#imgshell").attr("src","products/components/" + idarray[2] + ".png").error(                                         function(){                                             $("#cup-builder-error").fadein('fast');                                                                                          $("#cup-builder-error").fadeout('slow');                                         }); 

that code surrounded $("a").click( function(event){

what happens fade in / out routine loops number of time error happens.

what did wrong?

thanks help!

each time "a" clicked, new error event being bound. need once.

$('#imgshell').error(function () {     $("#cup-builder-error").fadein('fast');                                                  $("#cup-builder-error").fadeout('slow'); });  $('a').click(function (event) {     $('#imgshell').attr("src","products/components/" + idarray[2] + ".png");      event.preventdefault(); }); 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -