[Qual] Use jQuery property instead of attribute to test and set checked

This commit is contained in:
Raphaël Doursenaud 2015-05-12 14:22:00 +02:00
parent a94121a8c5
commit 0d8641a073
12 changed files with 33 additions and 33 deletions

View File

@ -873,7 +873,7 @@ if ($rowid)
} }
}); });
'; ';
if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").attr("checked",true);'; if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").prop("checked",true);';
print '});'; print '});';
print '</script>'."\n"; print '</script>'."\n";
} }

View File

@ -165,7 +165,7 @@ jQuery(document).ready(function() {
var row_num = field_id.split("_"); var row_num = field_id.split("_");
jQuery("#updateconst").show(); jQuery("#updateconst").show();
jQuery("#action").val('update'); jQuery("#action").val('update');
jQuery("#check_" + row_num[1]).attr("checked",true); jQuery("#check_" + row_num[1]).prop("checked",true);
}); });
}); });
</script> </script>

View File

@ -96,7 +96,7 @@ jQuery(document).ready(function() {
jQuery("#select_sql_compat").click(function() { jQuery("#select_sql_compat").click(function() {
if (jQuery("#select_sql_compat").val() == 'POSTGRESQL') if (jQuery("#select_sql_compat").val() == 'POSTGRESQL')
{ {
jQuery("#checkbox_dump_disable-add-locks").attr('checked',true); jQuery("#checkbox_dump_disable-add-locks").prop('checked',true);
} }
}); });

View File

@ -512,10 +512,10 @@ if (($action != 'create' && $action != 'add') || !$error)
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#checkall").click(function() { jQuery("#checkall").click(function() {
jQuery(".checkformerge").attr('checked', true); jQuery(".checkformerge").prop('checked', true);
}); });
jQuery("#checknone").click(function() { jQuery("#checknone").click(function() {
jQuery(".checkformerge").attr('checked', false); jQuery(".checkformerge").prop('checked', false);
}); });
}); });
</script> </script>

View File

@ -2099,7 +2099,7 @@ if ($action == 'create')
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#typedeposit, #valuedeposit").click(function() { jQuery("#typedeposit, #valuedeposit").click(function() {
jQuery("#radio_deposit").attr(\'checked\',\'checked\'); jQuery("#radio_deposit").prop("checked", true);
}); });
}); });
</script>'; </script>';
@ -2154,7 +2154,7 @@ if ($action == 'create')
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#fac_replacement").change(function() { jQuery("#fac_replacement").change(function() {
jQuery("#radio_replacement").attr(\'checked\',\'checked\'); jQuery("#radio_replacement").prop("checked", true);
}); });
}); });
</script>'; </script>';
@ -2200,7 +2200,7 @@ if ($action == 'create')
// Show credit note options only if we checked credit note // Show credit note options only if we checked credit note
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
if (! jQuery("#radio_creditnote").attr(\'checked\')) if (! jQuery("#radio_creditnote").prop("checked"))
{ {
jQuery("#credit_note_options").hide(); jQuery("#credit_note_options").hide();
} }
@ -2229,8 +2229,8 @@ if ($action == 'create')
print $desc; print $desc;
print '<div id="credit_note_options">'; print '<div id="credit_note_options">';
print '&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').attr(\'checked\',\'checked\'); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>"; print '&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop("checked", true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
print '<br>&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').attr(\'checked\',\'checked\'); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>"; print '<br>&nbsp;&nbsp;&nbsp; <input type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop("checked", true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
print '</div>'; print '</div>';
print '</td></tr>' . "\n"; print '</td></tr>' . "\n";

View File

@ -393,16 +393,16 @@ llxHeader('',$title);
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$("#checkall").click(function() { $("#checkall").click(function() {
$(".checkformerge").attr('checked', true); $(".checkformerge").prop('checked', true);
}); });
$("#checknone").click(function() { $("#checknone").click(function() {
$(".checkformerge").attr('checked', false); $(".checkformerge").prop('checked', false);
}); });
$("#checkallsend").click(function() { $("#checkallsend").click(function() {
$(".checkforsend").attr('checked', true); $(".checkforsend").prop('checked', true);
}); });
$("#checknonesend").click(function() { $("#checknonesend").click(function() {
$(".checkforsend").attr('checked', false); $(".checkforsend").prop('checked', false);
}); });
}); });
</script> </script>

View File

@ -414,11 +414,11 @@ if ($action == 'new')
{ {
jQuery("#checkall_'.$bid.'").click(function() jQuery("#checkall_'.$bid.'").click(function()
{ {
jQuery(".checkforremise_'.$bid.'").attr(\'checked\', true); jQuery(".checkforremise_'.$bid.'").prop(\'checked\', true);
}); });
jQuery("#checknone_'.$bid.'").click(function() jQuery("#checknone_'.$bid.'").click(function()
{ {
jQuery(".checkforremise_'.$bid.'").attr(\'checked\', false); jQuery(".checkforremise_'.$bid.'").prop(\'checked\', false);
}); });
}); });
</script> </script>

View File

@ -583,8 +583,8 @@ function setforfree() {
jQuery("#idprod").val(''); jQuery("#idprod").val('');
jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product
jQuery("#search_idprodfournprice").val(''); jQuery("#search_idprodfournprice").val('');
jQuery("#prod_entry_mode_free").attr('checked',true); jQuery("#prod_entry_mode_free").prop('checked',true);
jQuery("#prod_entry_mode_predef").attr('checked',false); jQuery("#prod_entry_mode_predef").prop('checked',false);
jQuery("#price_ht").show(); jQuery("#price_ht").show();
jQuery("#price_ttc").show(); // May no exists jQuery("#price_ttc").show(); // May no exists
jQuery("#tva_tx").show(); jQuery("#tva_tx").show();
@ -601,8 +601,8 @@ function setforfree() {
} }
function setforpredef() { function setforpredef() {
jQuery("#select_type").val(-1); jQuery("#select_type").val(-1);
jQuery("#prod_entry_mode_free").attr('checked',false); jQuery("#prod_entry_mode_free").prop('checked',false);
jQuery("#prod_entry_mode_predef").attr('checked',true); jQuery("#prod_entry_mode_predef").prop('checked',true);
jQuery("#price_ht").hide(); jQuery("#price_ht").hide();
jQuery("#title_up_ht").hide(); jQuery("#title_up_ht").hide();
jQuery("#price_ttc").hide(); // May no exists jQuery("#price_ttc").hide(); // May no exists

View File

@ -386,10 +386,10 @@ if (($action != 'create' && $action != 'add') || ! empty($mesgs)) {
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#checkall").click(function() { jQuery("#checkall").click(function() {
jQuery(".checkformerge").attr('checked', true); jQuery(".checkformerge").prop('checked', true);
}); });
jQuery("#checknone").click(function() { jQuery("#checknone").click(function() {
jQuery(".checkformerge").attr('checked', false); jQuery(".checkformerge").prop('checked', false);
}); });
}); });
</script> </script>

View File

@ -487,8 +487,8 @@ jQuery(document).ready(function() {
function init_needroot() function init_needroot()
{ {
/*alert(jQuery("#db_create_database").attr("checked")); */ /*alert(jQuery("#db_create_database").prop("checked")); */
if (jQuery("#db_create_database").attr("checked") || jQuery("#db_create_user").attr("checked")) if (jQuery("#db_create_database").prop("checked") || jQuery("#db_create_user").prop("checked"))
{ {
jQuery(".hideroot").show(); jQuery(".hideroot").show();
jQuery(".needroot").removeAttr('disabled'); jQuery(".needroot").removeAttr('disabled');

View File

@ -822,7 +822,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
if ( $(this).val() == 0 ) { if ( $(this).val() == 0 ) {
$("input[name=superadmin]") $("input[name=superadmin]")
.attr("disabled", true) .attr("disabled", true)
.attr("checked", false); .prop("checked", false);
$("select[name=entity]") $("select[name=entity]")
.attr("disabled", false); .attr("disabled", false);
} else { } else {
@ -831,7 +831,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
} }
}); });
$("input[name=superadmin]").change(function() { $("input[name=superadmin]").change(function() {
if ( $(this).attr("checked") == "checked" ) { if ( $(this).prop("checked", true) ) {
$("select[name=entity]") $("select[name=entity]")
.attr("disabled", true); .attr("disabled", true);
} else { } else {
@ -1823,9 +1823,9 @@ else
if (admin == 0) { if (admin == 0) {
$("input[name=superadmin]") $("input[name=superadmin]")
.attr("disabled", true) .attr("disabled", true)
.attr("checked", false); .prop("checked", false);
} }
if ($("input[name=superadmin]").attr("checked") == "checked") { if ($("input[name=superadmin]").prop("checked", true)) {
$("select[name=entity]") $("select[name=entity]")
.attr("disabled", true); .attr("disabled", true);
} }
@ -1833,7 +1833,7 @@ else
if ( $(this).val() == 0 ) { if ( $(this).val() == 0 ) {
$("input[name=superadmin]") $("input[name=superadmin]")
.attr("disabled", true) .attr("disabled", true)
.attr("checked", false); .prop("checked", false);
$("select[name=entity]") $("select[name=entity]")
.attr("disabled", false); .attr("disabled", false);
} else { } else {
@ -1842,7 +1842,7 @@ else
} }
}); });
$("input[name=superadmin]").change(function() { $("input[name=superadmin]").change(function() {
if ( $(this).attr("checked") == "checked" ) { if ( $(this).prop("checked", true)) {
$("select[name=entity]") $("select[name=entity]")
.attr("disabled", true); .attr("disabled", true);
} else { } else {

View File

@ -155,11 +155,11 @@ if ($action == 'edit')
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
$("#main_lang_default").change(function() { $("#main_lang_default").change(function() {
$("#check_MAIN_LANG_DEFAULT").attr(\'checked\', true); $("#check_MAIN_LANG_DEFAULT").prop("checked", true);
}); });
$("#main_size_liste_limit").keyup(function() { $("#main_size_liste_limit").keyup(function() {
if ($(this).val().length) $("#check_SIZE_LISTE_LIMIT").attr(\'checked\', true); if ($(this).val().length) $("#check_SIZE_LISTE_LIMIT").prop("checked", true);
else $("#check_SIZE_LISTE_LIMIT").attr(\'checked\', false); else $("#check_SIZE_LISTE_LIMIT").prop("checked", false);
}); });
}); });
</script>'; </script>';