optikalefx Posted February 25, 2008 Share Posted February 25, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/92960-disabling-a-button/ Share on other sites More sharing options...
DarkerAngel Posted February 25, 2008 Share Posted February 25, 2008 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();"> Quote Link to comment https://forums.phpfreaks.com/topic/92960-disabling-a-button/#findComment-476281 Share on other sites More sharing options...
phpQuestioner30 Posted February 25, 2008 Share Posted February 25, 2008 Why are you wanting to drag the button by itself; why don't you just put the button in another element, like a div; that will serve as the container that will be able to drag your button? Quote Link to comment https://forums.phpfreaks.com/topic/92960-disabling-a-button/#findComment-476363 Share on other sites More sharing options...
optikalefx Posted February 26, 2008 Author Share Posted February 26, 2008 well, how would you create the div to contain the object. thats kind of tedious. are you suggesting, disabling the button so it wont click, AND making the div? Keeping in mind through all this I cant edit the document directly, all the script is in an external JS file. Quote Link to comment https://forums.phpfreaks.com/topic/92960-disabling-a-button/#findComment-476496 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.