チェックボックスにチェックマークを付けて検証ボタンをクリックすると、次の例のように、チェックボックスがテーブル内の検証アイコンになります。こんにちは、チェックボックスをオンにして検証ボタンをクリックすると、次の例のように、チェックボックスがテーブル内の検証アイコンになります。
これが私のHTMLです:
<table class="table table-bordered" id="mytable">
<tr>
<th><input type="checkbox" id="check_all"></th>
<th>matricule</th>
<th>salary</th>
<th>number day</th>
<th>premium</th>
</tr>
<tr>
<td><input type="checkbox" class="checkbox"></td>
<td>1</td>
<td>5000</td>
<td>2</td>
<td><input type="text" name="prime" class="form-control" value="0"></td>
</tr>
<tr>
<td><input type="checkbox" class="checkbox"></td>
<td>2</td>
<td>6000</td>
<td>2</td>
<td><input type="text" name="prime" class="form-control" value="0"></td>
</tr>
<tr>
<td><input type="checkbox" class="checkbox"></td>
<td>1</td>
<td>7000</td>
<td>1</td>
<td><input type="text" name="prime" class="form-control" value="0"></td>
</tr>
</table>
<div class="form-group col-md-offset-5 ">
<button class="btn btn-success add-all" type="submit" id="hide">Pointage men</button>
</div>
これが私のJQueryです:
$(document).ready(function() {
$('#check_all').on('click', function(e) {
if ($(this).is(':checked', true)) {
$(".checkbox").prop('checked', true);
} else {
$(".checkbox").prop('checked', false);
}
});
$('.checkbox').on('click', function() {
if ($('.checkbox:checked').length == $('.checkbox').length) {
$('#check_all').prop('checked', true);
} else {
$('#check_all').prop('checked', false);
}
});
$("#hide").click(function() {
$("tr").each(function(i, r) {
if (i > 0 && $(r).find("input").first().prop("checked")) {
}
});
});
})
はっきりとわかったら、のinput checked
ように「アイコンの検証」に置き換えたい✔
ので、jQueryreplaceWith()
メソッドを使用して、UTF-8のその他の記号への入力を置き換えます。✔
お気に入り:
$("#hide").click(function() {
$("tr").each(function(i, r) {
if (i > 0 && $(r).find("input").first().prop("checked")) {
$(r).find("input").first().replaceWith('<span style="color: green;font-weight: bolder;">✔</span>');//✓ -
}
});
});
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加