How do I change the name of an element on page load using jquery?

I need to know how I can change the element name. I have the id of this element: "tester"

Good thing the loading problem on the page can be solved this way.

 $(document).ready(function() {

 });

      

but how can I change the name of an element like this?

<div id="tester" name="fun">
</div>

      

what i want as a result

<div id="tester" name="tester">
</div>

      

+2


a source to share


1 answer


Use . attr :



$("#tester").attr("name","tester");

      

+15


a source







All Articles