Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    The Netherlands
    Posts
    252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Event when checkbox is selected

    Hi all,

    I've got a question about which eventhandler to use for the following issue:

    I've got a checkbox and I want to make an alert when the checkbox is selected. Currently I've got the following code:

    <input type="checkbox" onclick="alert('I\'m selected')">

    When the checkbox is selected an alert pops up. However when I dis-select the checkbox an alert pops up as well.

    Should I use another eventhandler (onselect or something??) or is there another workaround?

    Thanx michiel

  • #2
    Regular Coder COBOLdinosaur's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    403
    Thanks
    2
    Thanked 32 Times in 32 Posts
    onClick="if(this.checked) alert('I\'m checked');"
    100% standards compliant code is 100% correct 100% of the time.
    one of my toys from my repository and perhaps some help getting help

    Cd&

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    The Netherlands
    Posts
    252
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanx!

    Cheers Michiel


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •