1

ここで見ることができるタイプ(sortable-accordion)のアイテムを複製したいと思います: http://jqueryui.com/demos/accordion/sortable.html

ここでわかるように、関数 clone() を使用して複製されたアイテムを追加します。

$("#cloneElement").click(function(){    
  var newElem = $('#acc-0').clone(true).attr('id', 'acc-1').addClass("clonedDiv");
 newElem.insertBefore($("#acc-0"));
}

私が複製したdivは次のようになります。

<div id="acc-0">
  <h3>
    <a id="section" href="#">Section </a>
  </h3> 
  <div>
  <fieldset  style="clear: both">
    <input type="text" name="section[]" id="section" value="">  
    <textarea name="content[]" id="content" class="text ui-corner-all"></textarea> 
   </fieldset>                          
 </div>
</div>

そして、これは私が新しい要素を追加するために使用するjqueryボタンです

<input type="radio" id="cloneElement" name="cloneElement" />

ボタンをクリックすると、要素が複製されて追加され、Firefox で表示されます。これは、Internet Explorer では機能しません。ボタンをクリックしても何も起こりません:( Explorerで機能しないのはなぜですか?

4

0 に答える 0