Vladislav 2 Posted August 8, 2016 Report Share Posted August 8, 2016 Hi great ubot community! Can someone point me to some tutorial or explain with simple words how one can disable or hide UI HTML button after click ? In a bot i am currently building i have "Start" button build via ui html command, i want after clicking it, the button to become disabled/hidden or both. Can someone please help me with this issue ? Quote Link to post Share on other sites
pash 504 Posted August 9, 2016 Report Share Posted August 9, 2016 i not good htmli thing this help you http://stackoverflow.com/questions/2294041/disable-the-button-after-clicking-the-button-oncehttp://network.ubotstudio.com/forum/index.php/topic/13972-help-to-run-define-with-button-in-ui-html/ ui html panel("<button type=\"button\" onclick=\"this.disabled = \'disabled\' ;ubot.runScript(\'ClearTemp()\');\">Click Me!</button>",200) define ClearTemp { alert("Success") } 1 Quote Link to post Share on other sites
darryl561 177 Posted August 9, 2016 Report Share Posted August 9, 2016 This example code will hide and disable the button on load("Bot Loaded") { set(#start button,"<button onclick=\"ubot.runScript(\'run()\')\">start</button>","Global") } ui html panel("<span variable=\"#start button\" fillwith=\"innerhtml\"></span>",100) define run { set(#start button,$nothing,"Global") wait(2) set(#start button,"<button onclick=\"ubot.runScript(\'run()\')\">start</button>","Global") } Quote Link to post Share on other sites
darryl561 177 Posted August 9, 2016 Report Share Posted August 9, 2016 Here is another method to disable and then re-enable a button ui html panel("<html><head> <script> function disableElement() \{ document.getElementById(\"thatbutton\").disabled=true; \} function enableElement() \{ document.getElementById(\"thatbutton\").disabled=false; \} window.onload = startInterval; function startInterval() \{ setInterval(\"reloadscript();\",300); \} function reloadscript() \{ if (document.getElementById(\"enablebuttonplz\")) \{ enableElement(); \} \} </script> </head><body> <button onclick=\"disableElement();ubot.runScript(\'okaybutton()\')\" id=\"thatbutton\">OK</button> <span variable=\"#enabledisable\" fillwith=\"innerhtml\"> </body></html>","") define okaybutton { wait(3) set(#enabledisable,"<div id=\"enablebuttonplz\"></div>","Global") wait(1) set(#enabledisable,"<div></div>","Global") alert("done !") } 1 Quote Link to post Share on other sites
Vladislav 2 Posted August 16, 2016 Author Report Share Posted August 16, 2016 Thank you pash and daryl561 for helping me solve this issue! Quote Link to post Share on other sites
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.