Difference between the one() and on() methods
The .one() method selects an element and executes the controller only once.
The .on() method selects one element and executes the controller many times.
xxxxxxxxxx
<button id="repeatedly">Using on()</button>
<button id="once">Using one()</button>
<!--Script jQuery-->
<script>
$(function(){
$("#repeatedly").on("click", function (event) {
alert('Using the on function, you can press the button repeatedly and the alert will always be executed');
});
$("#once").one("click", function (event) {
alert('Using the one function, you can press the button repeatedly and the alert will be executed only once');
});
});
</script>
<!--JQuery Library-->
<script src="https://code.jquery.com/jquery-3.6.3.min.js"></script>
Interesting Articles