开发者

Jquery - when attaching to certain events, original event handlers stop working

开发者 https://www.devze.com 2022-12-18 09:05 出处:网络
I tried being specific in the title, I hope it explained what I meant. I\'ve got several control in my web page. Some of them are quite complex, built by other people, and some of them I c开发者_Stack

I tried being specific in the title, I hope it explained what I meant. I've got several control in my web page. Some of them are quite complex, built by other people, and some of them I c开发者_StackOverflow中文版annot change.

Now, I wanted to add my own functionality to certain controls, say... User hovers over a button and show him an image. Problem is, that when I start writing my own jquery event handlers for example:

 $('div#special_div').click(function() {
               alert('clicked');
           })

the original event handlers won't work.

Any ideas why this happens?


I just tried creating two click events on jquery home page and it should actually work:

$( "#jq-header" ).click( function( ) { alert( "moo" ); } );
$( "#jq-header" ).click( function( ) { alert( "moo2" ); } );

My previous answer where I said it replaced events was wrong.

0

精彩评论

暂无评论...
验证码 换一张
取 消