this seems to be weird but it really happened.
I have this code working in IE8 and FF but I was shocked its not really working in Google Chrome
/*btnPost*/
$("input#btnPost").click(function(){
//check if the textbox contains anything...
var txtPostdata = $.trim($("div#txtPost").html());
if(txtPostdata.length <= 0){
d = createDialog("confirmation","are you sure to post a blank post?",{"modal":true});
d.dialog("open");
}
});
the thing that is not working there is the chrome cannot know the length of the txtPostdata variable. the txtPostdata holds the html that was grabbed in a CONTENTEDITABLE DIV.
i tried to pull out the TODO inside the if statement and it works fine. I tried also doing this
/*btnPost*/
$("input#btnPost").click(function(){
//check if the textbox contains anything...
var txtPostdata = $.trim($("div#txtPost").html());
if(txtPostdata == ""){
d = createDialog("confirmation","are you sure to post a blank post?",{"modal":true});
d.dialog("open");
}
});
but still not working… is there any way i can solve this issue in chrome? my version of chrome is 17.0.
Please try it
here
When I used
.text()instead of.html()it worked ok.