-1

我希望将“1”添加到 id conCol 以使其成为 conCol1。请有人告诉我我是怎么做的,因为我下面的陈述不起作用。此外,是否有可能获得“第一列”的值,即条件#0 使其成为条件#1?

newElem.children('select :nth-child(2)').attr('id', 'conCol' + newNum).attr('name', 'name' + newNum);

<tr id="condition1" class="clonedInput">
              <td class="first-column">Condition #0</td>
              <td><span style="float:left; padding-right: 10px;">
                <select id="conCol" name="conCol" class="standard_select" style="width:147px; background:#fff;">
4

1 回答 1

0

假设newElemtr元素(包装在 jQuery 中):

newElem.find('select').attr('id', 'conCol' + newNum).attr('name', 'conCol' + newNum);
newElem.find('.first-column').text('Condition #1');

.find().text()的文档

于 2012-06-25T20:29:18.737 回答