へー、jQueryにこんな便利なメソッドがあったんだー。
<script>
jQuery(function($){
$('#hoge').on('click',function(e){
e.preventDefault();
$(this).replaceWith('hello world');
});
});
</script>
</head>
<body>
<input type="button" value="Run" id="hoge">
</body>自分自身をremoveしてさらに新しい要素に書き換えてくれるんだー。これいい。
0 コメント:
コメントを投稿