我使用jQuery Mobile和一次我點擊從這個列表中的鏈接:如何將列表項目從一個列表移動到另一個列表?
<div id="scroller">
<div class="trans">
<ul id="thelist" data-corners= "false" data-role="listview">
<div class = "theListItem" data-role="collapsible-set" data-collapsed="false">
<li><a class= "left" data-inset="true" data-transition="pop" href="YesNoMaybe.html"><h4>Think Coffee</h4><h3>$3.50</h3></a></li>
<li><a class= "left" data-inset="true" data-transition="pop" href="YesNoMaybe.html"><h4>Think Coffeadsf dsadsf ads faf adsf adsf adsf sadf asdf adsfadsfadsfadsfadsf sadfasdfe</h4><h3>$3.50</h3></a></li>
<li><a class= "left" data-inset="true" data-transition="pop" href="YesNoMaybe.html"><h4>sup Coffee</h4><h3>$3.50</h3></a></li>
</div>
</ul>
</div>
</div>
如果<h4>
和<h3>
文字代替這個名單上的文字我愛:
<ul id="thelist" data-corners= "false" data-role="listview">
<div class = "theListItem" data-role="collapsible-set" data-collapsed="false">
<li class="purchase" ><a data-inset="true" href="#"><h4>Think Coffee</h4><h3>$3.50</h3></a></li>
</div>
</ul>
我試過這個:
$('#transPage').live('pageinit', function() {
$('a').click(function(){
var $move = $(this).closest('li').appendTo("#YesNoMaybePage .theListItem");
});
});
並沒有得到。這些列表位於不同的頁面上。所有的建議都比歡迎。感謝世界。我欠你的時間。
您必須先將其從DOM中移除; (''''')。'remove()。appendTo ...' – dualed
and use .on instead of .live – mplungjan
'$('#transPage')'或'$('#trans' )'? – hjpotter92