Document.getElementById('btnid').disabled is not working in firefox and chrome

Asked
Active3 hr before
Viewed126 times

7 Answers

working
90%

Try setting the disabled attribute directly:,[elem].disabled = condition ? true : false; //done!,I'm using JavaScript for disabling a button. Works fine in IE but not in FireFox and chrome, here is the script what I'm working on:, Acknowledging the referee in arXiv preprint

function disbtn(e) {
   if (someCondition == true) {
      document.getElementById('btn1').setAttribute("disabled", "disabled");
   } else {
      document.getElementById('btn1').removeAttribute("disabled");
   }
}
load more v
88%

I use JavaScript to disable the button. It works fine in IE, but not in FireFox and chrome, here is the script I'm working on:,Try setting the disabled attribute directly:,How to set the start time for the chronometer - android,use setAttribute () and removeAttribute ()

I use JavaScript to disable the button. It works fine in IE, but not in FireFox and chrome, here is the script I'm working on:

function disbtn(e) {
   if (someCondition == true) {
      document.getElementById('btn1').disabled = true;
   } else {
      document.getElementById('btn1').disabled = false;
   }

And in my html I:

 <input type="button" id="btn1" value="submit" />
load more v
72%

HTMLSelectElement.disabled,HTMLTableHeaderCellElement,HTMLTableSectionElement,HTMLTableCaptionElement

aSelectElement.disabled = aBool;
load more v
65%

36 have this problem ,I want to submit above form. But it shows me JavaScript error in Console that "TypeError: document.getelementbyid(...) is null" This error is for code : document.getElementById("my_form").submit(); , 2 replies ,Thank you very much. I could solve this error by using 'innerHTML' instead of document.write as it is deprecated.

<html>

 <head>
  <title>Port Scanner for Mozilla Firefox</title>
 </head>
 
 <body>

  <form name="my_form" id="my_form" method="post" action="#" onsubmit="return displayMessage();">
   <p align="center">URL/Domain Name/IP Address: <input type="text" size="20" name="uri" value="" placeholder="http://www.google.com" required/></p>
   <table align="center" border="1" width=100% bgcolor="#f4fff0" bordercolor="green" cellspacing="2" cellpadding="2">
    <tr>
     <td align="center">
      Start port: <input type="text" size="5" name="start_port" maxlength="5">
      End port: <input type="text" size="5" name="end_port" maxlength="5"><br>
      <input type="submit" value="Scan all ports" name="scan_all"><br>
      <input type="submit" value="Scan only open ports" name="scan_open">      
     </td>
    
    </tr>
    <tr>
     <td align="center">
      <input type="text" size="20" name="scan_tcp"><br>
      <font color="#b1b1b1">Enter port numbers separated by space. (e.g. 21 25 80)</font><br>
      <input type="submit" value="Scan TCP ports" name="scan_tcp_ports">     
     </td>
    </tr>
    <tr>
     <td align="center">
      <input type="submit" value="Scan common service ports" name="scan_common_tcp"><br>
      <input type="submit" value="Scan common Trojan ports" name="scan_common_trojan_tcp">     
     </td>
    </tr>
   </table>
  </form>
     <script type="text/javascript">
   function displayMessage()
   {
     if(document.my_form.uri.value==0)
     {
      document.write("<font color='red'><i>Please enter URL/Domain Name/IP Address.</i></font>");
      return false;
     }
     document.write("<DIV id='loading'><BR><BR><font color='#FF6600'><i>Please wait... The ports are being scanned...</i></font></DIV>");
     document.getElementById("my_form").submit();     
   }
      window.onload=function()
   {  
    document.getElementById("loading").style.display="none";  
      }  
  </script>
 </body>
</html>
75%

I then want to disable the textfields again when the user saves; I have this code bound to my save button:,When people click the 'edit' button of my application, the disabled textfields become editable:, jquery - . attr ("disabled", "disabled") problem , jquery - . attr ('disabled ','disabled') or. Attr ('disabled ', true) is used to disable input

When people click the 'edit' button of my application, the disabled textfields become editable:

$("#bewerken").click(function(e) {
   $("input[disabled='disabled']").removeAttr('disabled');
});
load more v
40%

    var btn = document.getElementById(btnID); ,function setImage(btnID) { ,                    OnClientClick="disableBtn(this.id, 'Submitting...')" ,Disable the button during PostBack with or without the present of validation control

0
22%

/document.getElementById ('btnid'). disabled não está funcionando no firefox e no chrome,Estou usando JavaScript para desativar um botão. Funciona bem no IE mas não no FireFox e no Chrome, aqui está o script em que estou trabalhando:,document.all vs. document.getElementById,Javascript: document.getElementById () retorna NULL

Estou usando JavaScript para desativar um botão. Funciona bem no IE mas não no FireFox e no Chrome, aqui está o script em que estou trabalhando:

function disbtn(e) {
   if (someCondition == true) {
      document.getElementById('btn1').disabled = true;
   } else {
      document.getElementById('btn1').disabled = false;
   }

E no meu html eu tenho: 

<input type="button" id="btn1" value="submit" />
load more v

Other "working-undefined" queries related to "Document.getElementById('btnid').disabled is not working in firefox and chrome"