title: How to change background color of TextBox by Javascript?
body: <p>I am trying to change background color of textbox by using javascript but my code is not working. I search SO but not find any suitable answer. Here is my code.</p>
  
  <pre><code>&lt;head&gt;
      &lt;script type="text/javascript" language="javascript"&gt;
          function abc() {
              var v = document.getElementById("&lt;%=TextBox1.ClientID%&gt;");
              v.setAttribute('BackColor', 'Red');
          }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form1" runat="server"&gt;
      &lt;div&gt;
          &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt;
          &lt;asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="abc()" onclick="Button1_Click"/&gt;
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/zUOF3.jpg" alt="enter image description here"></p>