Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bind to checked for a checkbox only?

Tags:

jquery

I have a checkbox and I am using jquery. I want to popup a dialog box when a user checks the checkbox. However if they uncheck the box nothing should popup.

How can I do this? Also I need to use jquery live or livequery as the checkbox is not displayed on page load.

like image 748
chobo2 Avatar asked Dec 10 '22 15:12

chobo2


1 Answers

$('#checkbox').live('change', function(){
    if($(this).is(':checked')){
        popUpFunction();
    }
});
like image 123
antpaw Avatar answered Dec 12 '22 05:12

antpaw