how to disable button onclick to get rid of double submissions?

Discussion in 'JavaScript' started by DrivingTraffic.com, Jan 16, 2009.

  1. #1
    I need to figure out how to disable the submit button once it's click so that people can't submit twice. I have this:

    <input src="images/n2.jpg" name="submit" id="submit" type="image" onclick="this.disabled=true">


    Doesn't seem to work though.
     
    DrivingTraffic.com, Jan 16, 2009 IP
  2. yoavmatchulsky

    yoavmatchulsky Member

    Messages:
    57
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    48
    #2
    its either:

    this.style.disabled = true;

    or

    this.style.enabled = false;

    i always get those two confused..
     
    yoavmatchulsky, Jan 16, 2009 IP
  3. gnp

    gnp Peon

    Messages:
    137
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    
    <input src="images/n2.jpg" name="submit" id="submit" type="image" onclick="this.disabled='disabled'">
    
    HTML:
    this should work
     
    gnp, Jan 16, 2009 IP