Jump to content

Checkbox with jQuery not working at all


ankur0101

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.