javascript - jQuery bind function to parent div but not child anchor and vice-versa -


मेरे पास एक div है, जिसमें से कुछ एंकर लिंक हैं:

  & lt; Div id = "myDiv" & gt; + ---------------------------- + | | | & Lt; एक कक्षा = "myAnc" & gt; ... & lt; / a & gt; | | & Lt; एक कक्षा = "myAnc" & gt; ... & lt; / a & gt; | | | + ---------------------------- +   

मैं एक क्लिक ईवेंट को < कोड> #myDiv यह कॉल myFunction1 () पर .myAnc टैग कॉल myFunction2 () है। JQuery के बाँध का उपयोग करके, क्या होता है कि दोनों myFunction1 और myFunction2 को आप जो भी क्लिक करते हैं (div या the anchor) कहते हैं।

मैं यह कैसे सुनिश्चित कर सकता हूं कि वे अपने दो अलग-अलग कार्यों (और केवल उन फ़ंक्शन) पर कॉल कर सकते हैं?

में myFunction2 (ev) कॉल करें:

  ev.stopPropagation ();    

Comments

Popular posts from this blog

android - How can I execute default sms app? -

jquery .css('text-decoration') doesn't work from parents -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -