I need to change the id attribute of a div on click.
<div class="xtra" id="id1"><a href="#"><span>Next</span></a></div>
How would I do that?
I’ve tried:
$j("#id1").attr('id', 'id2');
but that didn’t work.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
try this:
I am not sure why you would ever want to do this, that is how you would do it.
IDs are not meant to change, they are meant to be unique to a specific element.
Classes are usually used when changing css back and forth.