課程
/前端開發(fā)
/jQuery
/jQuery基礎(chǔ)課程
$(".red").after($(".red").clone());可以,$(".red").before($(".rad").clone());咋不行?
2016-04-28
源自:jQuery基礎(chǔ)課程 5-8
正在回答
$(".red").before($(".rad").clone());
你的“red”寫錯了 寫成了 rad
梁_Ricky
sunnylinner 提問者
weibo_大Eamon_0 回復(fù) sunnylinner 提問者
我自己測試了一下。可以的啊。你怎么不行?貼個代碼。。你去試試。。我測試了是可以。
<!DOCTYPE html><html>??? <head>??????? <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />??????? <title>挑戰(zhàn)題</title>??????? <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>??? </head>?? ???? <body>?????? ???????? <button class="g">點我加載逗逗相關(guān)</button>??????? <script>??????? $(function(){?????? ??? ?$(".g").bind("click",function(){?????? ??? ??? ?//$(this).after($(this).clone());?? ??????? ??? ??? ?$(this).before($(this).clone());?????? ??? ?})?????? ??? ???????? })?????? ??? ???????? </script>??? </body></html>
舉報
加入課程學(xué)習(xí),有效提高前端開發(fā)速度
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2016-04-28
$(".red").before($(".rad").clone());
你的“red”寫錯了 寫成了 rad
2016-04-28
我自己測試了一下。可以的啊。你怎么不行?貼個代碼。。你去試試。。我測試了是可以。
<!DOCTYPE html>
<html>
??? <head>
??????? <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
??????? <title>挑戰(zhàn)題</title>
??????? <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
??? </head>?? ?
??? <body>?????? ?
??????? <button class="g">點我加載逗逗相關(guān)</button>
??????? <script>
??????? $(function(){
?????? ??? ?$(".g").bind("click",function(){
?????? ??? ??? ?//$(this).after($(this).clone());?? ?
?????? ??? ??? ?$(this).before($(this).clone());
?????? ??? ?})?????? ??? ?
??????? })?????? ??? ?
??????? </script>
??? </body>
</html>