如何删除 jquery 中的前缀。?
<td><span id="stu1" class="reject-student ">Not Selected</span></td>
<td><span id="stu2" class="select-student ">Selected</span></td>
<td><span id="stu5" class="select-student ">Selected</span></td>
jQuery:
var selected = $(".select-student").map(function() {
return this.id;
}).get();
我试过这样:
var selected = $(".select-student").map(function() {
var id = $('span[id^="stu"]').remove();
return this.id;
}).get();
我得到像 stu1 stu2 这样的结果,我只想发送 1 和 2 .. 我该怎么做。?