How to bind to check only for checkbox?

I have a checkbox and I'm using jquery. I want to pop up a dialog when the user checks the checkbox. However, if they clear the check box, nothing should pop up.

How can i do this? I also need to use jquery live or livequery, since the checkbox does not appear when the page loads.

+4
source share
1 answer
$('#checkbox').live('change', function(){ if($(this).is(':checked')){ popUpFunction(); } }); 
+14
source

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


All Articles