我正在使用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");
});
});
无处可去。列表位于不同的页面上。所有建议都非常受欢迎。谢谢世界。我非常感谢你。
答案 0 :(得分:0)
尝试这些方法。
$('#transPage').on('pageinit', function() {
$('a').click(function(){
var $h4 = $(this).find('h4').text(); // select the text of h4
$('.purchase h4').text($h4); // insert the text in the target
var $h3 = $(this).find('h3').text();
$('.purchase h3').text($h3);
});
});
我在jsFiddle上测试了它并且它有效。 http://jsfiddle.net/3JWFJ/