开发者

Problem facing parsing apostrophe in jquery.html()

I am stuck with a weird problem of parsing an aphostrophe. I cant use an escape character in "test" selector because this value is coming from the DB. How do i display this correctly.. :-(

Script is as follows

$(document).ready(function() {
var getVal = $('.test').text();
$('.newstest').html(getVal);
});

Html Code is as follows

<div class="test">&开发者_如何学JAVA;amp;apos;&amp;quot;</div><br /><br />
<div class="newstest"></div>

Thanks


Try this:

if($('.text').text().contains("\'"))
{
 //Do something here. Either replace the apostrophe with another character or display a   
 //default value.
}
else
{
 var getVal = $('.test').text(); 
 $('.newstest').html(getVal); 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜