Is $("<div />").appendTo($mySelector) safe to use? Will it work in every browser even though is not a valid HTML element?
I’m asking because it’s really easier to use than $("<div><div />")
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.
Yes. If you look at the source this case is even optimized.
This regexp will match if there is or is not a
/, and it is not included in a group. The only grouped expression is the actual tag name (div), which is used.If you look more closesly you can see that the following are all handled the very same way: