title: Adding id to input element
body: <p>I am trying to add an id to an existing input element. The element I am trying to add the id to is this:</p>
  
  <pre><code>&lt;input type="submit" name="submit" value="Save Changes" /&gt;
  </code></pre>
  
  <p>I have tried getting the element by name and add the id by doing this:</p>
  
  <pre><code>$(document).ready(function() {
          $("input[name='submit']").attr('id','btnSubmit');
  });
  </code></pre>
  
  <p>However this does not appear to be working. Any suggestions?</p>
  
  <p>The input field is created in backend Java code which I do not have access to. So in the jsp I am working in I just delete the input field on page load and then create a new button which solves my problem. I know its not very efficient but unfortunately I can't access the java code to just change the id there.</p>