在没有唯一ID的元素之间显示jquery var
我对 jquery 没有太多经验,但我一直在尝试更多地使用它,但遇到了问题。
我试图在某些没有唯一类或 id 的元素之间显示变量。
我刚刚意识到我之前尝试显示变量的表单元素确实具有唯一的名称,但我仍然不确定如何在基于名称的元素之前显示变量。
<td class="pme-key-1">Last Edit By</td>
<td class="pme-value-1">
<input class="pme-input-1" type="text" name="PME_data_LastEdit" value="10" size="60" maxlength="128" />
</td>
我想使用 jquery 将变量放置在输入字段之前。
I don't have much experience with jquery, but I've been trying to use it more and have run into a problem.
I'm trying to display a variable between certain elements that don't have unique classes or id's.
I just realized that the form elements I'm trying to show the variables before do have unique names, but I'm still not really sure how to show a variable before an element based on a name.
<td class="pme-key-1">Last Edit By</td>
<td class="pme-value-1">
<input class="pme-input-1" type="text" name="PME_data_LastEdit" value="10" size="60" maxlength="128" />
</td>
I'd like to use jquery to place the variable before the input field.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
何时,例如您想在哪个事件上显示变量以及哪个元素触发此事件?这将是将 yourvar 的内容放在输入标记前面:
如果名称是唯一的,您也可以使用
When, so for example on which event do you want to display the variable and which element triggers this event? This would be the bit to just put the contents of yourvar in front of the input tag:
If the name is unique, you can also use
您可以使用选择器的唯一名称,并在函数之前插入变量,如下所示:
You can use the unique name for the selector, and before function to insert variable like this:
http://api.jquery.com/before/
http://api.jquery.com/before/