Jump to content
UBot Underground

[Solved]Hide/disable Button After Click ?


Recommended Posts

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 ?

Link to post
Share on other sites

i not good html

i thing this help you

 

http://stackoverflow.com/questions/2294041/disable-the-button-after-clicking-the-button-once

http://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")
}
  • Like 1
Link to post
Share on other sites

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")
}
Link to post
Share on other sites

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 !")
}
  • Like 1
Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...