How does the .on of jquery trigger only once per element?

$("-sharpaaa").on("input propertychange","input", function() {
    
});

inputinput
Mar.09,2021

  1. first of all, in this requirement, the status of each input may be inconsistent (some are "triggered" and some are "not triggered"), so in this case, either bind the event to each input separately (that is, abandon the event agent), or keep the proxy, but set a status indication for each input (it is recommended to use the data-* custom attribute. JQ has ready-made API to support)
  2. For
  3. scenarios bound to each input, you can bind the event with .one () , or use .on () , and then drop the event with $(this) + .off () in the callback. Of course, if the event name is too long, you can add the namespace
  4. .
  5. Note above: events need to be bound again in the newly generated input. Of course, callbacks can be written as named functions, which are easier to bind than simple you ya.
  6. if you still adhere to the proxy scheme, you need to add a state variable to each input, that is, add a statement such as $(this) .data ('do') to the callback, judge its value before execution, and jump out of the callback directly if it has been executed.

use .one

$("-sharpaaa").one("input propertychange","input", function() {
    
});

var b=0
$("-sharpaaa").on("input propertychange","input", function() {

if(b==1)
{
}
else
{
//
b=1
}
    
});

then you can only record which nodes have been clicked. You can't use .one .

  

.off () unbind, and internally unbind the events of the triggering element after triggering

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ec8a0e-48cbd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ec8a0e-48cbd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?