我想使用jquery添加以下行
我正在创建一个函数,用于添加表中带有输入和选择框的行数。。。 我的页面结构是我想使用jquery添加以下行,jquery,Jquery,我正在创建一个函数,用于添加表中带有输入和选择框的行数。。。 我的页面结构是 <!--FROM HERE--> <tr> <th>Track 1:</th> <td><input name="track[]" type="text" class="track" maxlength="150" onkeyup="lookup(this.value);" onblur="fill();"/> <div
<!--FROM HERE-->
<tr>
<th>Track 1:</th>
<td><input name="track[]" type="text" class="track" maxlength="150" onkeyup="lookup(this.value);" onblur="fill();"/>
<div class="suggestionsBox" id="suggestions" style="display: none;"><img src="images/upArrow.png" style="position: relative; top: -12px; left: 50px;" alt="upArrow" />
<div class="suggestionList" id="autoSuggestionsList"> </div>
</div></td>
<td><img width="27" height="27" src="images/error.png" alt="Error" class="error" id="errorcategory"></td>
</tr>
<tr>
<th>Category:</th>
<td ><select name="category" id="category" style="width:318px;">
<?php getsongcategory($category); ?>
</select></td>
<td><img width="27" height="27" src="images/error.png" alt="Error" class="error" id="errorcategory"></td>
</tr>
<tr>
<th valign="top" style="padding-top:12px;">Poet:</th>
<td ><select name="poetid" id="poetid" style="width:318px;">
<?php fetch_poet_name($poetid); ?>
</select><br/><br/>
<input name="poetname" type="text" id="poetname" maxlength="80" onkeyup="lookup(this.value);" onblur="fill();" style="display:none;"/>
<div class="suggestionsBox" id="suggestions" style="display: none;"><img src="images/upArrow.png" style="position: relative; top: -12px; left: 50px;" alt="upArrow" />
<div class="suggestionList" id="autoSuggestionsList"> </div>
</div></td>
<td><img width="27" height="27" src="images/error.png" alt="Error" class="error" id="errorpoetid" ></td>
</tr>
<tr>
<td colspan="3" id="track_1"> </td>
</tr>
<!---TILL HERE->
如果我在这里,考虑使用一个包含HTML的模板文件,并将JavaScript附加到想要的位置。我使用模板库。
是否要将所有html插入到要插入的html中的某个位置?这会导致DOM错误,因为DOM树不能是自引用的。您必须将CSS选择器与$()
一起使用,所以$(“选择”)
和$(“输入”)
一起使用。好的,我知道了。。。。但是让我知道如何从。。。表示在曲目id
$("<select/>", {
class: 'selectdoctor',
name: 'selectdoctor' + i,
id: 'selectdoctor' + i
}).appendTo("#prescriptiondiv").after("<br/>");
$("<input/>", {
type: 'text',
class: 'textinput',
name: 'textinput' + i,
id: 'textinput' + i
}).appendTo("#prescriptiondiv").after("<br/><input type='file' id='imageinput"+ i +"' class='imageinput' /><br/><br/>");