2016-10-18 22 views
0

で働いていない:追加私はdiv要素でアンカータグを追加しようとしていますが、残念ながらそのが動作していないjQueryのv1.11.3

以下は、私のコード

$(document).ready(function() { 
 
    $('.test-inner').append('<a href="#" class="new-img-holder"></a>'); 
 
    $('.test-image').appendTo('.new-img-holder'); 
 
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
 
<div class="test-inner"> 
 
    <img class="test-image" src="cine-sudarshan.jpg" alt=""> 
 
</div>

+0

どこ 'fancybox-inner'のですか? –

+0

申し訳ありません、ただ私のJSを更新します –

+0

あなたのコードは大丈夫です。バグはどこかにあるはずです。 –

答えて

0

あなたのコードですでも動作していますV1.2.3

あなたのコードの別の部分にリンクされています。

$(document).ready(function(){ 
 
    $('.test-inner').append('<a href="#" class="new-img-holder"></a>'); 
 
    $('.test-image').appendTo('.new-img-holder'); 
 
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script> 
 
<div class="test-inner"> 
 
    <img class="test-image" src="cine-sudarshan.jpg" alt=""> 
 
</div>

+3

あなたは何をお答えしていますか? –

関連する問題