日期:2014-05-16 浏览次数:20366 次
<INPUT style="WIDTH: 100%" value='表单2' jQuery1369647167633="271">
<INPUT style="WIDTH: 100%" value='表单2' jQuery1369647167633="272">
<INPUT style="WIDTH: 100%" value='表单2' jQuery1369647167633="273">
<INPUT style="WIDTH: 100%" value='表单2' jQuery1369647167633="274">
<script src="http://www.coding123.net/js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
var html = $('#dv').html(), inputs = $('#dv input'), idx = 0;
var rx = /(jQuery\d+)="(\d+)"/gi;
while (m = rx.exec(html)) {
alert(m[1] + '\n' + m[2]);
inputs[idx].value += ',' + m[2];
idx++;
}
});
</script>
<div id="dv">
<INPUT style="WIDTH: 100%" value='表单2' jQuery1369647167633="271">
<INPUT style="WIDTH: 100%" value='表单2' jQuery1369647167633="272">
<INPUT style="WIDTH: 100%" value='表单2' jQuery1369647167633="273">
<INPUT style="WIDTH: 100%" value='表单2' jQuery1369647167633="274">
</div>
$(function(){
$(':input[^jQuery\d+]').each(function(){
for(var i in this.attributes){
if(this.attributes[i].name&&!this.attributes[i].name.toLowerCase().indexOf('jquery')){
$(this).val(this.attributes[i].value);
}
}
});
});