[英]selecting last square bracket input element in collection
This here JSFiddle: http://jsfiddle.net/3pLqa5n0/ 这是JSFiddle: http : //jsfiddle.net/3pLqa5n0/
The result contains an input element and a textarea element. 结果包含一个输入元素和一个textarea元素。
Each time you click on the first input element, it appends another input element and textarea element. 每次单击第一个输入元素时,它都会附加另一个输入元素和textarea元素。
However, I want this to only happen when one clicks on the last input element (not the first). 但是,我希望只有在单击最后一个输入元素(而不是第一个)时才发生这种情况。
In the code, I have done: 在代码中,我已经完成了:
$('#deleteandadd input[name="inputName[]"]:last')
But the ':last' is obviously not working. 但是':last'显然不起作用。 How may I make this work?
我该如何工作?
Aside: when we use square brackets in element names, to send data to PHP, are these technically arrays? 撇开:当我们在元素名称中使用方括号将数据发送到PHP时,这些在技术上是数组吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.