待定位的小bug

var newOption = '<tr id="option' + optionIndex_BusinessApplication + '_WorkRequirement">'
        + '<td><input type="text" id ="number' + optionNumber_BusinessApplication + '_WorkRequirementID" name="number'
            + optionIndex_BusinessApplication + '_WorkRequirement" style="text-align:center;"  size="5" readonly="true" value="' + optionNumber_BusinessApplication + '"></td>'
        + '<td><select id="myLove'+optionIndex_BusinessApplication+'" name="workType' + optionIndex_BusinessApplication
            + '_WorkRequirement" style="width:100%;"><option value="检定">检定</option><option value="校准">校准</option></select></td>'
        + '<td><input value="' + jsonData.rows[i].workRequirement + '" type="text" name="workRequirement' + optionIndex_BusinessApplication
            + '_WorkRequirement" style="width:99%;"></td>'
        + '<td><a  id="delWorkRequirement' + optionIndex_BusinessApplication
            + '_BusinessApplication" href="javascript:void(0)" onclick="WorkRequirement_BusinessApplication(' + optionIndex_BusinessApplication + ')">删</a></td>'
        + '</tr>';

            $('#WorkRequirement_BusinessApplication').append(newOption);
            //$('#myLove' + optionIndex_BusinessApplication).val("校准");
            $('input[name="workType' + optionIndex_BusinessApplication + '_WorkRequirement"]').attr('value','校准');

这个写法无效:

 $('input[name="workType' + optionIndex_BusinessApplication + '_WorkRequirement"]').attr('value','校准');
换成下面的也无效:
 $('input[name="workType' + optionIndex_BusinessApplication + '_WorkRequirement"]').val('校准');
但是用这个就没问题:
//$('#myLove' + optionIndex_BusinessApplication).val("校准");

相关的html页面代码为:
<table width="100%" id="WorkRequirement_BusinessApplication" border="1" cellspacing="0" cellpadding="0" bordercolor="#808080">
                                <thead>
                                    <tr>
                                        <th width="50">序号</th>
                                        <th width="80">工作类型</th>
                                        <th>工作要求</th>
                                        <th width="100">操作</th>
                                    </tr>
                               </thead>
</table>

 

posted on 2014-07-05 23:03  IT流浪者  阅读(137)  评论(0编辑  收藏  举报