Jump to content

disabling a button


optikalefx

Recommended Posts

I know you can do like element.disabled = true; if the element happens to be a button.  I also wrote some code to check if the element is an input and the attribute is submit or button, and then set it to disabled.

 

But that doesnt quite solve my problem.  I wrote a script that allows all elements to be dragged.  the problem is, when you click on a button to drag it, the link that it has is envoked.  for links, i solved this by setting href to javascript: void 0;  but how can i do such a thing with buttons.  I thought disabling would work, but it just grays the button out and thus i cant drag it all.  Is there another way to disable a button?

Link to comment
Share on other sites

I don't understand exactly what your trying to do but,

 

you can try setting the onclick to a function

 

and have the function return false, I don't know if that'll work but it might be worth a try

 

<script type="text/javascript">

function thisfunction() {

    return false;

}

</script>

<input type="button" name="button" value="Button Text" onclick="thisfunction();">

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.