Skip to content

Instantly share code, notes, and snippets.

@WenLiangTseng
Created July 22, 2013 05:09
Show Gist options
  • Save WenLiangTseng/6051406 to your computer and use it in GitHub Desktop.
Save WenLiangTseng/6051406 to your computer and use it in GitHub Desktop.
取代所有字串
//text版
$('#test').each(function(){
var $this = $(this);
var t = $this.text();
$this.html(t.replace('&lt','<').replace('&gt', '>'));
});
//HTML版
$('#test').each(function(){
var $this = $(this);
var t = $this.html();
$this.html(t.replace('&lt','<').replace('&gt', '>'));
});
//實際
<script type="text/javascript">
jQuery('document').ready(function($) {
$("p.ngg-img-title").each(function() {
var ieg_ngg_title = $(this).text();
ieg_ngg_title = ieg_ngg_title.replace('&lt;','<').replace('&gt;', '>');
$(this).html(ieg_ngg_title);
});
});
</script>
<script type="text/javascript">
jQuery('document').ready(function($) {
$("p.ngg-img-title").each(function() {
var textTobeReplace = $(this).text();
textTobeReplace = textTobeReplace.replace('&lt;','<').replace('&gt;', '>');
$(this).html(textTobeReplace);
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment