使用jQuery从输入值中删除给定的字符串 [英] Remove a given string from an input value using jQuery
本文介绍了使用jQuery从输入值中删除给定的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有三个整数值的隐藏字段,例如:
I have a hidden field with three integer values, example:
<input type="hidden" value="10 23 42">
我想使用jQuery删除给定的值,例如"10",这将保留其余的"23 42"值.
I want to use jQuery to remove a given value, say "10", which would leave the remaining "23 42" value.
推荐答案
<script>
$("input").val($("input").val().replace("10 ", ""));
</script>
这篇关于使用jQuery从输入值中删除给定的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文