how to make a button disappear after it is clicked once

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mdburton
    New Member
    • Mar 2007
    • 15

    how to make a button disappear after it is clicked once

    onclick="this.h ref='javascript :void(0)';this. disabled=1">

    ive tried that, but it renders it useless and doesnt make it 'submit'

    it should be able to work, but so the user cannot submit it twice if they tried to 'machine gun' type thing using their mouse to submit repeatedly

    I guess this can be considered an HTML problem not PHP but im using it in php in the sense that the button clicked triggers the form to load and it has data that is used in php to put into the database

    = )
  • bucabay
    New Member
    • Apr 2007
    • 18

    #2
    Originally posted by mdburton
    onclick="this.h ref='javascript :void(0)';this. disabled=1">

    ive tried that, but it renders it useless and doesnt make it 'submit'

    it should be able to work, but so the user cannot submit it twice if they tried to 'machine gun' type thing using their mouse to submit repeatedly

    I guess this can be considered an HTML problem not PHP but im using it in php in the sense that the button clicked triggers the form to load and it has data that is used in php to put into the database

    = )
    This is definitely a JavaScript question.

    As this can only be achieved via JavaScript, you don't have to worry about the href attribute.

    So do something like:

    [HTML]onclick="this.o nclick=function () { return false; };"[/HTML]

    If the onclick returns false then the browser will stop the link/form from being submitted.

    So after the first click, the onclick will look like:

    [HTML]onclick="return false;"[/HTML]

    So next clicks will not trigger the form submission, or link submission etc.

    Comment

    Working...