我的php将抓取随机行并写入<ul>和<li>并使用html5 sortable
<ul id='sortable_A'>
<li>A1</li>
<li>A2</li>
<li>A3</li>
<li>A4</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
所以现在我怎么能用jquery以这种方式让所有的孩子变成li li_A = A1,A2,A3,A4,然后我会用它来相应地更新数据库
Ps:或者还有其他更好的方法吗?
你可以做
// Get all elements
var li_A = $('#sortable_A li')
// Iterate on the elements and create an array
.map(function() {
return $(this).text();
})
// Get the array
.get()
// join the values
.join(',');
Run Code Online (Sandbox Code Playgroud)
http://jsfiddle.net/nicolapeluchetti/hhkaV/
| 归档时间: |
|
| 查看次数: |
876 次 |
| 最近记录: |