私の目標は、入力セクション内にクローン ボタンがあることです。クリックすると、jquery 経由で入力された入力値を含むセクション全体がクローンされます。
<section class='sectionContent'>
<button onClick="clone_section(this)"></button>
<input type="text" name="someinput">
<input type="text" name="someinput">
<input type="text" name="someinput">
<input type="text" name="someinput">
<input type="text" name="someinput">
<input type="text" name="someinput">
<script type="text/javascript">
function clone_section(this) {
console.log($(this).find("input"));
}
</script>
関数内でログをコンソールすると、次のような直接コンソールとは異なるものが得られます
console.log('.sectionContent').find('input');
私がやろうとしているのは、すべての入力値をフェッチし、セクション全体を .clone() してから、すべての入力値を新しいセクションに入れることです。
誰かがより良いアイデアを思いつきますか?アドバイスください、どうもありがとうございました!