<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="http://common.cnblogs.com/script/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$('#btnId').click(function(){
fuzzyMatch();
});
});
//jquery选择器模糊匹配
function fuzzyMatch(){
//var obj = jQuery('#divId').find("input[name*='ipt']"); //前后都模糊匹配,例如:ciptzhang diptpeng
//var obj = jQuery('#divId').find("input[name^='ipt']"); //只匹配前半部,例如:iptzhang iptpeng
//var obj = jQuery('#divId').find("input[name$='ipt']"); //只匹配后半部分,例如:zhangipt pengipt
var obj = jQuery('#divId').find("input[name='zhangipt'],input[name='pengipt']"); //多个精确匹配
obj.val('abc');
alert(obj.length);
}
</script>
<body>
<div id="divId">
<input type="text" name="zhangipt"/><br/>
<input type="text" name="pengipt"/><br/>
<div>
<input type="button" value="测试" id="btnId"/>
</body>
</html>