如何将 jquery contains 用于文本框,我附上了小提琴链接供您参考,
<div id="txtCon">
<input type="text" name="man-news" />
<input type="text" name="milkman" />
<input type="text" name="letterman2" />
<input type="text" name="newmilk" />
has
</div>
Script:
$('input[name*="new"]').val('has');
$('input:text:contains("has")').css("color","red");
关联: