Implement listener using on() method.
Jquery offers another alternative to the dblclick() function The on() function is a much more flexible way of listening for events in jquery.
Here is an example of the on() function in use: https://raw.githubusercontent.com/finsweet/jqueryCourse/main/jquery%20events/ex13.js?actionable=true
We can rewrite our list item example so that it uses the on() function and item color changes according to its text. https://raw.githubusercontent.com/finsweet/jqueryCourse/main/jquery%20events/ex14.js?actionable=true
$(document).ready(function(){
XT1
});
</script>
Live demo
<div id="minidivpage" class="example-live"><h4 class="heading-4">Colours in a webflow list:</h4><ul role="list" class="list"><li>Purple</li><li>Blue</li><li>Magenta</li></ul><a id="alertButton" href="#" class="w-button">Button alert</a></div>
$(document).ready(function() {
XT1
});
</script>