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 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2012
    Posts
    51
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Disabling a button onclick

    What have I done wrong here?


    <INPUT id="purchase" onclick="document.getElementById("purchase").disabled = true;" type="submit" value="PURCHASE">

  • #2
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    Code:
     
    <INPUT id="purchase" onclick="document.getElementById('purchase').disabled = true;" type="submit" value="PURCHASE">
    or even easier

    Code:
     
    <INPUT id="purchase" onclick="this.disabled = true;" type="submit" value="PURCHASE">

  • Users who have thanked webdev1958 for this post:

    Noonga (03-03-2012)

  • #3
    New Coder
    Join Date
    Feb 2012
    Posts
    51
    Thanks
    5
    Thanked 0 Times in 0 Posts
    never mind.

  • #4
    New Coder
    Join Date
    Feb 2012
    Posts
    51
    Thanks
    5
    Thanked 0 Times in 0 Posts
    The second one was cool. Thanks man!


  •  

    Posting Permissions

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