html - JavaScript event delegation - how to prevent parent's event from firing -


इस सवाल का पहले से ही एक उत्तर है: < / p>

  • 2 जवाब

    मेरे पास एक Ul सूची में 3 li s इसके अंदर है। ये li s एक स्लाइडशो के प्रभाव को बनाने के लिए ul के मार्जिन को बदलने के लिए बटन हैं li बटन सभी ठीक काम कर रहे हैं लेकिन जब भी उल क्लिक किया जाता है, अर्थात, li से ul के अलावा कोई भी क्षेत्र, मुझे ul के लिए गलत मार्जिन मिल रहा है। क्या आप ul पर

    पर गोलीबारी से घटना को रोक सकते हैं का उपयोग करें:

    ईवेंट को अधिसूचित होने से किसी भी माता पिता के हैंडलर्स को रोकने से, घटना को डीओएम ट्री को बुदबुदाते से रोकता है।

    उदाहरण के लिए:

      $ ('ul')। पर ('क्लिक करें', 'ली', फ़ंक्शन (ईवेंट) {event.stopPropagation ()});    

Comments

Popular posts from this blog

c# - The item with identity 'Id' already exists in the metadata collection. Parameter name: item -

sql - PostgreSQL automatically update row at specific date -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -