Is there a maximum number of elements I can bind a jquery event with?

I am creating a simple one page application that allows someone to curate a list of json feeds. I had a problem trying to bind the mouseenter / mouseleave event to all the inputs on the page with this class. Just put the first work, and the second - no.

I need to execute jquery:

$(".feed").on("mouseenter", ".publish", function(){ console.log("feed") }); //this is for test purposes $(".feed").on("mouseenter", ".keys-input", function(){ console.log($(this)); $(this).siblings(".delete").fadeIn(75); }); $(".feed").on("mouseleave", ".keys-input", function(){ $(this).siblings(".delete").fadeOut(75); }); 

and the following html:

 <div class="feed"><!-- sorry for the confusion --> <div class="feed-header"> <h2>pga-2013.json</h2> <button class="publish button-white-bg button-save">Publish</button> </div> <div class="kvRow collapsed"> <span class="delete icon">x</span> <input type="text" class="keys-input" value="free" disabled=""/> <input type="text" class="values-input" value="0" disabled=""/> </div> </div> 

The reason I ask if there is a maximum number of elements you can bind to is because the ".feed" event ".feed" and there are only 11 of them on dom, while the ".keys-input" event is missing, and there are 7266 of them at home. Either that, or I'm blind and doing something dumb ...

here is a fiddle with fewer elements, but the same code that works http://jsfiddle.net/khLPc/

this is the problem: Event on a disabled input , inputs are disabled, so they won’t trigger events that are bananas for me ...

+4
source share
1 answer

The event does not fire on a disabled item.

Turn on the input and it will work. Check here, I have included one of the input fields: http://jsfiddle.net/balintbako/khLPc/1

Apparently I need to include the code too:

 <input type="text" class="keys-input" value="free"/> 
+1
source

Source: https://habr.com/ru/post/1496003/


All Articles