Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to disable and enable a button?

Moran1
Kilo Contributor

i have this button: 

<g:dialog_buttons_ok_cancel ok_id="submitdata" ok="return go_ok()" ok_type="button" ok_text="Run" ok_style_class="btn btn-primary" cancel_type="button" cancel_id="canceldata" cancel_style_class ="btn btn-default" cancel="return goCancel()"/>

and i am looking for a way to disable it and also a way to enable it later by using document.getElementById.

can someone tell me how to do those two things? 

1 ACCEPTED SOLUTION

Saurav11
Kilo Patron
Kilo Patron

You can use:-

  • document.getElementById("Button").disabled = true;
    
  • document.getElementById("Button").disabled = false;

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

View solution in original post

2 REPLIES 2

Maik Skoddow
Tera Patron
Tera Patron

Hi

please look into the underlying Heisenberg style guide. You only have to add/remove the respective CSS classes

https://hi.service-now.com/styles/heisenberg/styleguide/docs/components_-_buttons.html

Kind regards
Maik

Saurav11
Kilo Patron
Kilo Patron

You can use:-

  • document.getElementById("Button").disabled = true;
    
  • document.getElementById("Button").disabled = false;

 

Hope this helps. Please mark the answer as correct/helpful based on impact.