How to change the id of the div using jquery?
I have div with id (initially as ‘first’) and a dropdown (with values ‘first’, ‘second’).
On changing the dropdown value, i need to change the id of the div according to dropdown value.
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.
You’ll need to use a non-ID selector to get the DIV with the ID you want to change. In the above example I have assumed a class called
something.Is there any particular reason you want to change the id of the div? I’m sure there’s a better solution. Could you elaborate a bit more?