ようやくユーザー入力項目をチェックリストに追加できるようになりました。ただし、それらが追加されたとき、それらは Jquery Mobiles スタイルを採用していません。
これは何が起こっているかのスクリーンショットです
これはHTMLです:
<h3>My items</h3>
<table id="myTable">
<tr>
<td>
<label for="checkbox65">
<input name="checkbox65" class="checkbox65" type="checkbox" />
My stuff
</label>
</td>
</tr>
<tr>
<td>
<fieldset data-role="controlgroup">
<label for="textinput4">
Add new item
<input name="new_item" id="textinput4" placeholder="" value="" type="text" />
</label>
</fieldset>
<button id="add">Add</button>
/td>
</tr>
</table>
これは、ユーザー入力項目をチェック リストに追加するためのスクリプトです。
<script type="text/javascript">
$(document).on('click', '#add', function(e) {
var $this = $(this);
var $firstRow = $this.closest('table').find('tr:first');
var $newRow = $firstRow.clone();
var input = $newRow.find(':input').remove();
input.prop('checked', false);
$newRow.empty().append(input).append(' ' + $('#textinput4').val());
$newRow.insertAfter($firstRow);
});
</script>
おそらく含めることができる別の質問を読みました
$('[type='submit']').button();
ユーザー入力項目のスタイルを設定するため。ただし、これが自分に適しているかどうか、またはスクリプトのどこに配置するかはわかりません。
ありがとう。