我有一個輸入和一個模式,我想文平原從輸入追加到模態獲取純文本和追加到另一個DIV
$("#myBtn").click(function() {
//$('#title-for-modal').clone().appendTo('#title-to-modal');
console.log($("#title-for-modal").contents().appendTo('#title-to-modal').end());
//$('#title-for-modal').append('#title-to-modal'));
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span class="item-details">
<div class="row padding-tab-row">
<span class="text-design col-xs-6 text-left">Add Keywords</span>
<input id="title-for-modal" class="col-xs-6 transparent-input" type="text" name="keywords">
</div>
</span>
<div id="next-button2" class="text-center">
<button id="myBtn" name="next_button2" class="next-button-tab-2">Next</button>
</div>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header text-center">
<span class="close "></span>
<p id="title-to-modal" class="modal-title"></p>
</div>
<div class="modal-body">
<p>Some text in the Modal Body</p>
<p>Some other text...</p>
</div>
</div>
</div>
這就是我試過,但將無法正常工作,如果任何人都可以幫助我的那個..謝謝
輸入在哪裏? –
缺少大量的信息,你有2個具有相同ID的對象? '模式標題',因爲這是錯誤的。我還可以看到你的'輸入標題爲模態'是空的 –
@ Alexandru-IonutMihai我的壞..我想更新 – Apers1952