Button to be unclickable after it is clicked

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

    Button to be unclickable after it is clicked

    How exactly is this possible?

    I have messed around with some javascript to try to do this before, but what I used never seemed to work

    like after the user clicks it once, it becomes unclickable or vanishes completely would also be fine with me

    This is just one irritating thing I can't get to work for me and non of the examples I've found onliny work either
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    Originally posted by mdburton
    How exactly is this possible?

    I have messed around with some javascript to try to do this before, but what I used never seemed to work

    like after the user clicks it once, it becomes unclickable or vanishes completely would also be fine with me

    This is just one irritating thing I can't get to work for me and non of the examples I've found onliny work either
    Post me your Code.

    Kind regards,
    Dmjpro.

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5390

      #3
      hi ...

      to disable a button use the disable property:

      [CODE=html]<input type="button" value="test_but ton" onclick="this.d isabled = true;"/>[/CODE]
      kind regards

      Comment

      • mdburton
        New Member
        • Mar 2007
        • 15

        #4
        thanks MUCH for that example ; )


        but whenever it is like this

        Code:
        <form METHOD="POST" ACTION="login.php?ballaa"><input type="submit" value="test_button" onclick="this.disabled = true;"/></form>
        it doesnt 'submit' the form to do the action

        guess i should of been more specific than button since your answer works just not for what i didnt say ; P

        Comment

        • dmjpro
          Top Contributor
          • Jan 2007
          • 2476

          #5
          Originally posted by mdburton
          thanks MUCH for that example ; )


          but whenever it is like this

          Code:
          <form METHOD="POST" ACTION="login.php?ballaa"><input type="submit" value="test_button" onclick="this.disabled = true;"/></form>
          it doesnt 'submit' the form to do the action

          guess i should of been more specific than button since your answer works just not for what i didnt say ; P
          Have a try with this.

          [CODE=html]<form METHOD="POST" ACTION="login.p hp?ballaa" onsubmit="retur n test()"><input type="submit" value="test_but ton" id="sub"/></form>[/CODE]


          [code=javascript]
          function test()
          {
          document.getEle mentById('sub') .disabled = true;
          return true;
          }
          [/code]

          Good Luck :-)

          Kind regards,
          Dmjpro.

          Comment

          • mdburton
            New Member
            • Mar 2007
            • 15

            #6
            well that worked like a charm

            thanks very much = )

            Comment

            Working...