Using jQuery, is it possible to change all matched elements to a different type?
For example, can I select all a tags, $("a"), and change them to inputs?
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.
No, you can’t actually change it, but you can replace them with a new element using the
replaceWith()method:If there are any attributes that you want to keep, you’ll need to manually set them: