fakhravari
دوشنبه 16 اردیبهشت 1392, 12:44 عصر
با سلام
برای مثال
<div id="d1">
<input id="Checkbox1" type="checkbox" />
<input id="Checkbox2" type="checkbox" />
<input id="Checkbox3" type="checkbox" />
</div>
<div id="d2">
<input id="Checkbox4" type="checkbox" />
<input id="Checkbox5" type="checkbox" />
<input id="Checkbox6" type="checkbox" />
</div>
<script>
$(document).ready(function () {
$("div#d1 input[type='checkbox']").prop("checked", function (i) {
if (i === 1)
$(this).attr("checked", true);
else
$(this).attr("checked", false);
});
$("div#d2 input[type='checkbox']").each(function (i) {
if (i === 0 || i === 1)
$(this).attr("checked", true);
else
$(this).attr("checked", false);
});
});
</script>
ایا کد های بالا درستن؟:متفکر:
برای مثال
<div id="d1">
<input id="Checkbox1" type="checkbox" />
<input id="Checkbox2" type="checkbox" />
<input id="Checkbox3" type="checkbox" />
</div>
<div id="d2">
<input id="Checkbox4" type="checkbox" />
<input id="Checkbox5" type="checkbox" />
<input id="Checkbox6" type="checkbox" />
</div>
<script>
$(document).ready(function () {
$("div#d1 input[type='checkbox']").prop("checked", function (i) {
if (i === 1)
$(this).attr("checked", true);
else
$(this).attr("checked", false);
});
$("div#d2 input[type='checkbox']").each(function (i) {
if (i === 0 || i === 1)
$(this).attr("checked", true);
else
$(this).attr("checked", false);
});
});
</script>
ایا کد های بالا درستن؟:متفکر: