<div id="a"></div>
if($("#a").is(':empty') )
alert("empty");
In IE8, it shows alert but Mozila 3.6 and Opera 11 do not show the alert. Why?
Answer:
if(!$.trim( $("#a").html() ) )
alert("empty");
this code run in ie and mozila
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.
Your code is valid and should work in those browsers. I tested it in FireFox and Chrome and it works.
Verify that you do not have any other elements in your page that also have an id of
a. Most browsers compliant with web standards correctly refuse to acknowledge any duplicated elements and often it causes JavaScripts to fail due to errors.