JQuery noobie can't make a checked checkbox show an alert?

Try this if you press but the check box is not checked as you said above.

To fire an alert if the button is pressed but the checkbox isn't checked. Try this if you press but the check box is not checked as you said above: $("#checkbox2"). Click(function(){ if($("#checkbox2").

Is(':checked') == false) { alert("im checked"); } }); . Updated based on comment: To show an alert if checked, you can simple do like: $("#checkbox2"). Click(function(){ if($("#checkbox2").

Is(':checked')) { alert("im checked"); } }); Also from your code, it seems that you are missing the ); at the end for the: $(function().

Thanks, I'm totally new to jQuery, but also there's some in there to say that if it is checked, show an alert.. But that doesn't happen either. – Kyle Sevenoaks Apr 26 '10 at 8:06 @Kyle Sevenoaks: see my updated answer please. – Sarfraz Apr 26 '10 at 8:09 Thanks, that's already in the script.. – Kyle Sevenoaks Apr 26 '10 at 8:10 @Kyle Sevenoaks: you are missing ); at the end, see my asnwer plz – Sarfraz Apr 26 '10 at 8:12 Aha!

Thanks :) One more thing, can I add more than one function to the selector? – Kyle Sevenoaks Apr 26 '10 at 8:15.

Try this: $(document). Ready(function() { $("#checkbox2"). Click(function() { if ($(this).

Attr("checked")) { alert("im checked"); } }); $("#fullfor_btn"). Click(function(e) { if ($("#checkbox2"). Attr("checked") == false) { alert("you did not check the agree to terms..."); e.preventDefault(); } }); }).

Your checkbox has the id "checkbox2", but you are trying to access it using the id "terms" in the click handler for the button. Update You are missing the closing parenthesis for the $(function(){...}) call. This throws a syntax error when the page is loaded, and the code in the script block is never run.

Change the last line in the script block from: } to: }); I have tested the code with this change, and it works fine.

There isn't any element with id="terms" in your HTML.

Thanks, just changed it and updated the question, but it still won't fire. – Kyle Sevenoaks Apr 26 '10 at 8:02.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions