替换页面加载中的字段中的字符 [英] Replace characters in a field on page load
本文介绍了替换页面加载中的字段中的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从字段中删除不需要的字符.我目前在该字段中的结果是<DT></DT><DD>57 MINUTES</DD>
I need to remove the unwanted characters from a field. my current results inside the field are <DT></DT><DD>57 MINUTES</DD>
我尝试了一下,但是没有用
i try this but is not working
jQuery('display').val(function(index, val){
return val.replace('<DT></DT><DD>', '').trim();
});
<input type="hidden" id="display" value="<DT></DT><DD>0 MINUTES</DD>">
想要的结果只有几分钟.
the wanted result its only the minutes.
推荐答案
$($('#display').val()).text()
$($('#display').val())
这会将您的值转换为html.
$($('#display').val())
This will convert your value into html.
.text()
将检索分钟字段.
这篇关于替换页面加载中的字段中的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文