Jump to content

Checkbox with jQuery not working at all


Go to solution Solved by yomanny,

Recommended Posts

Hi,

I have html code like,

<script>
    
     $("#premium_seat").click( function(){
   if($('#premium_seat').attr('checked') == 'checked')
   {
       alert('Bingo');
   }
   
});
     
     
    </script>
<div class="control-group">
<label class="control-label" for="inputEmail"><b>Premium Seat</b></label>
<div class="controls">
             <input type="checkbox" name="premium_seat" id="premium_seat" />
             </div>
             </div>
 

 

What I want to do is when I tick on this checkbox, it will show me Bingo Dialogue box.
This works here > http://jsfiddle.net/TyMNp/
But on my designing page, it is not working at all. I am using jquery v1.7.2
 
However other jquery functions such as

 

$(document).ready(function() {
   document.getElementById("premium_pointer").innerHTML="";
   //$("#premium_amount :input").attr("disabled", true);
   
});
 

 

are working fine
 

 

Link to comment
https://forums.phpfreaks.com/topic/275692-checkbox-with-jquery-not-working-at-all/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.