Bug 16238: Use .prop() instead of .attr() for 'checked'
authorJulian Maurice <julian.maurice@biblibre.com>
Sat, 9 Apr 2016 05:58:42 +0000 (07:58 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 29 Apr 2016 14:18:24 +0000 (14:18 +0000)
According to https://jquery.com/upgrade-guide/1.9/#attr-versus-prop-
.attr() is no longer correct to access the checked state of a checkbox.

This patch do the following replacements:
  .attr('checked')               =>  .prop('checked')
  .attr('checked, '')            =>  .prop('checked', false)
  .attr('checked, 'checked')     =>  .prop('checked', true)
  .attr('checked', boolValue)    =>  .prop('checked', boolValue)
  .removeAttr('checked')         =>  .prop('checked', false)
  .attr('checked') == 'checked'  =>  .is(':checked')

Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

32 files changed:
koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc
koha-tmpl/intranet-tmpl/prog/en/js/acq.js
koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js
koha-tmpl/intranet-tmpl/prog/en/js/marc_subfields_structure.js
koha-tmpl/intranet-tmpl/prog/en/js/merge-record.js
koha-tmpl/intranet-tmpl/prog/en/js/pages/batchMod.js
koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersubscription.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/merge.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-layout.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_stats.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt
koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt

index dabad6d..b4405b1 100644 (file)
@@ -3,14 +3,14 @@
 <script type="text/javascript">//<![CDATA[
        $(document).ready(function(){
                $(".none").click(function(){
-                       if($(this).attr("checked")){
+                       if($(this).prop("checked")){
                                var rowid = $(this).attr("id");
                                newid = Number(rowid.replace("none","")) 
-          $("#sms"+newid).removeAttr("checked");
-          $("#email"+newid).removeAttr("checked");
-          $("#phone"+newid).removeAttr("checked");
-          $("#digest"+newid).removeAttr("checked");
-          $("#rss"+newid).removeAttr("checked");
+          $("#sms"+newid).prop("checked", false);
+          $("#email"+newid).prop("checked", false);
+          $("#phone"+newid).prop("checked", false);
+          $("#digest"+newid).prop("checked", false);
+          $("#rss"+newid).prop("checked", false);
                        }
                });
         $("#info_digests").tooltip();
                  <input type="checkbox"
                  id="sms[% messaging_preference.message_attribute_id %]"
                  name="[% messaging_preference.message_attribute_id %]"
-                 value="sms" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" />
+                 value="sms" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" />
               [% ELSE %]
                  <input type="checkbox"
                  id="sms[% messaging_preference.message_attribute_id %]"
                  name="[% messaging_preference.message_attribute_id %]"
-                 value="sms" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" />
+                 value="sms" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" />
               [% END %]
           [% END %]
       </td>[% END %]
                  <input type="checkbox"
                  id="phone[% messaging_preference.message_attribute_id %]"
                  name="[% messaging_preference.message_attribute_id %]"
-                 value="phone" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" />
+                 value="phone" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" />
               [% ELSE %]
                  <input type="checkbox"
                  id="phone[% messaging_preference.message_attribute_id %]"
                  name="[% messaging_preference.message_attribute_id %]"
-                 value="phone" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" />
+                 value="phone" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" />
               [% END %]
           [% END %]
       </td>[% END %]
             <input type="checkbox"
                  id="email[% messaging_preference.message_attribute_id %]"
                  name="[% messaging_preference.message_attribute_id %]"
-                 value="email" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" />
+                 value="email" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" />
               [% ELSE %]
             <input type="checkbox"
                  id="email[% messaging_preference.message_attribute_id %]"
                  name="[% messaging_preference.message_attribute_id %]"
-                 value="email" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" />
+                 value="email" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" />
               [% END %]
           [% END %]
       </td>
                 <input type="checkbox"
                      id="digest[% messaging_preference.message_attribute_id %]"
                      value="[% messaging_preference.message_attribute_id %]"
-                     name="digest" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" />
+                     name="digest" checked="checked" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" />
               [% ELSE %]
                 <input type="checkbox"
                      id="digest[% messaging_preference.message_attribute_id %]"
                      value="[% messaging_preference.message_attribute_id %]"
-                     name="digest" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" />
+                     name="digest" onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" />
               [% END %]
           [% END %]
       </td>
             <input type="checkbox"
                  id="rss[% messaging_preference.message_attribute_id %]"
                  name="[% messaging_preference.message_attribute_id %]"
-                 value="rss"   [% messaging_preference.transport_rss %] onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').removeAttr('checked');" />
+                 value="rss"   [% messaging_preference.transport_rss %] onclick = "$('#none'+'[% messaging_preference.message_attribute_id %]').prop('checked', false);" />
           [% END %]
       </td>
       [% ELSE %]
index ddd95bc..9d3983c 100644 (file)
@@ -345,7 +345,7 @@ function checkBudgetParent(budgetId, newBudgetParent) {
 }
 
 function hideColumn(num) {
-    $("#hideall,#showall").removeAttr("checked").parent().removeClass("selected");
+    $("#hideall,#showall").prop("checked", false).parent().removeClass("selected");
     $("#"+num).parent().removeClass("selected");
     var hide = Number(num.replace("col","")) + 2;
     // hide header and cells matching the index
@@ -353,7 +353,7 @@ function hideColumn(num) {
 }
 
 function showColumn(num){
-    $("#hideall").removeAttr("checked").parent().removeClass("selected");
+    $("#hideall").prop("checked", false).parent().removeClass("selected");
     $("#"+num).parent().addClass("selected");
     // set the index of the table column to hide
     show = Number(num.replace("col","")) + 2;
@@ -365,12 +365,12 @@ function showAllColumns(){
     $("#selections").checkCheckboxes();
     $("#selections span").addClass("selected");
     $("#plan td:nth-child(2),#plan tr th:nth-child(2)").nextAll().show();
-    $("#hideall").removeAttr("checked").parent().removeClass("selected");
+    $("#hideall").prop("checked", false).parent().removeClass("selected");
 }
 function hideAllColumns(){
     var allCols = $("#plan th").length;
     $("#selections").unCheckCheckboxes();
     $("#selections span").removeClass("selected");
     $("#plan td:nth-child(2),#plan th:nth-child(2)").nextUntil("th:nth-child("+(allCols-1)+"),td:nth-child("+(allCols-1)+")").hide(); // hide all but the last two columns
-    $("#hideall").attr("checked","checked").parent().addClass("selected");
+    $("#hideall").prop("checked", true).parent().addClass("selected");
 }
index 5137b7d..bf419d7 100644 (file)
@@ -6,33 +6,33 @@ $(document).ready(function() {
     // Handle the select all/none links for checkouts table columns
     $("#CheckAllRenewals").on("click",function(){
         $("#UncheckAllCheckins").click();
-        $(".renew:visible").attr("checked", "checked" );
+        $(".renew:visible").prop("checked", true);
         return false;
     });
     $("#UncheckAllRenewals").on("click",function(){
-        $(".renew:visible").removeAttr("checked");
+        $(".renew:visible").prop("checked", false);
         return false;
     });
 
     $("#CheckAllCheckins").on("click",function(){
         $("#UncheckAllRenewals").click();
-        $(".checkin:visible").attr("checked", "checked" );
+        $(".checkin:visible").prop("checked", true);
         return false;
     });
     $("#UncheckAllCheckins").on("click",function(){
-        $(".checkin:visible").removeAttr("checked");
+        $(".checkin:visible").prop("checked", false);
         return false;
     });
 
     // Don't allow both return and renew checkboxes to be checked
     $(document).on("change", '.renew', function(){
         if ( $(this).is(":checked") ) {
-            $( "#checkin_" + $(this).val() ).removeAttr("checked");
+            $( "#checkin_" + $(this).val() ).prop("checked", false);
         }
     });
     $(document).on("change", '.checkin', function(){
         if ( $(this).is(":checked") ) {
-            $( "#renew_" + $(this).val() ).removeAttr("checked");
+            $( "#renew_" + $(this).val() ).prop("checked", false);
         }
     });
 
@@ -603,6 +603,6 @@ $(document).ready(function() {
             } else {
                 $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
             }
-        } ).attr( 'checked', false );
+        } ).prop('checked', false);
     }
  });
index ce50e67..2745564 100644 (file)
@@ -11,7 +11,7 @@ $(document).ready(function() {
 /* Function to enable/disable hidden values checkboxes when Flag is (de)selected */
 function enable_cb(tab) {
     if ($("#hidden_flagged_" + tab).is(':checked')) {
-        $('.inclusive_' + tab).attr('disabled',true).removeAttr('checked');
+        $('.inclusive_' + tab).attr('disabled',true).prop('checked', false);
     }
     else {
         $('.inclusive_' + tab).removeAttr('disabled');
@@ -132,11 +132,11 @@ function populateHiddenCheckboxes(tab) {
         collapsed_checked = true;
     } // else if ( hidden_value == '8') { skip }
 
-    $("#hidden_opac_" + tab).attr('checked',opac_checked);
-    $("#hidden_intranet_" + tab).attr('checked',intranet_checked);
-    $("#hidden_editor_" + tab).attr('checked',editor_checked);
-    $("#hidden_collapsed_" + tab).attr('checked',collapsed_checked);
-    $("#hidden_flagged_" + tab).attr('checked',flagged_checked);
+    $("#hidden_opac_" + tab).prop('checked',opac_checked);
+    $("#hidden_intranet_" + tab).prop('checked',intranet_checked);
+    $("#hidden_editor_" + tab).prop('checked',editor_checked);
+    $("#hidden_collapsed_" + tab).prop('checked',collapsed_checked);
+    $("#hidden_flagged_" + tab).prop('checked',flagged_checked);
 
     enable_cb(tab);
 
index 9c3f492..d8938b9 100644 (file)
@@ -44,7 +44,7 @@ function build_target_record($sources) {
         'code' : subfield
       });
     } else {
-      $field_li.find('input.fieldpick').attr('checked', true);
+      $field_li.find('input.fieldpick').prop('checked', true);
       target_record[field] = [{
         'id' : $field_li.attr('id'),
         'tag' : field,
@@ -141,7 +141,7 @@ function rebuild_target($sources, $target) {
           $field_clone.find('ul').append($subfield_clone);
         }
       } else {
-        $('#' + field.id).find('input.fieldpick').removeAttr('checked');
+        $('#' + field.id).find('input.fieldpick').prop('checked', false);
       }
     }
   }
@@ -155,11 +155,11 @@ $(document).ready(function(){
     $('input.fieldpick').click(function() {
         var ischecked = this.checked;
         if (ischecked) {
-          $(this).removeAttr('checked');
+          $(this).prop('checked', false);
           if (!field_can_be_added($('#tabs'), $(this).parent())) {
             return false;
           }
-          $(this).attr('checked', 'checked');
+          $(this).prop('checked', true);
         }
 
         // (un)check all subfields
@@ -173,11 +173,11 @@ $(document).ready(function(){
     $("input.subfieldpick").click(function() {
       var ischecked = this.checked;
       if (ischecked) {
-        $(this).removeAttr('checked');
+        $(this).prop('checked', false);
         if (!subfield_can_be_added($('#tabs'), $(this).parent())) {
           return false;
         }
-        $(this).attr('checked', 'checked');
+        $(this).prop('checked', true);
       }
       rebuild_target($('#tabs'), $('#resultul'));
     });
index 133194a..40ae5bd 100644 (file)
@@ -8,19 +8,19 @@ function hideColumns(){
   valCookie = $.cookie("showColumns");
   if(valCookie){
     valCookie = valCookie.split("/");
-    $("#showall").removeAttr("checked").parent().removeClass("selected");
+    $("#showall").prop("checked", false).parent().removeClass("selected");
     for( i=0; i<valCookie.length; i++ ){
       if(valCookie[i] !== ''){
         index = valCookie[i] - 2;
         $("#itemst td:nth-child("+valCookie[i]+"),#itemst th:nth-child("+valCookie[i]+")").toggle();
-        $("#checkheader"+index).removeAttr("checked").parent().removeClass("selected");
+        $("#checkheader"+index).prop("checked", false).parent().removeClass("selected");
       }
     }
   }
 }
 
 function hideColumn(num) {
-  $("#hideall,#showall").removeAttr("checked").parent().removeClass("selected");
+  $("#hideall,#showall").prop("checked", false).parent().removeClass("selected");
   valCookie = $.cookie("showColumns");
   // set the index of the table column to hide
   $("#"+num).parent().removeClass("selected");
@@ -56,7 +56,7 @@ Array.prototype.remove = function(from, to) {
 };
 
 function showColumn(num){
-  $("#hideall").removeAttr("checked").parent().removeClass("selected");
+  $("#hideall").prop("checked", false).parent().removeClass("selected");
   $("#"+num).parent().addClass("selected");
   valCookie = $.cookie("showColumns");
   // set the index of the table column to hide
@@ -84,13 +84,13 @@ function showAllColumns(){
     $("#selections span").addClass("selected");
     $("#itemst td:nth-child(2),#itemst tr th:nth-child(2)").nextAll().show();
     $.removeCookie("showColumns", { path: '/' });
-    $("#hideall").removeAttr("checked").parent().removeClass("selected");
+    $("#hideall").prop("checked", false).parent().removeClass("selected");
 }
 function hideAllColumns(){
     $("#selections").unCheckCheckboxes();
     $("#selections span").removeClass("selected");
     $("#itemst td:nth-child(2),#itemst th:nth-child(2)").nextAll().hide();
-    $("#hideall").attr("checked","checked").parent().addClass("selected");
+    $("#hideall").prop("checked", true).parent().addClass("selected");
     var cookieString = allColumns.join("/");
     $.cookie("showColumns", cookieString, { expires : date, path: '/' });
 }
@@ -115,7 +115,7 @@ function hideAllColumns(){
     });
     $("#clearonloanbutton").click(function(){
       $("#itemst input[name='itemnumber'][data-is-onloan='1']").each(function(){
-        $(this).attr('checked', false);
+        $(this).prop('checked', false);
       });
       return false;
     });
@@ -128,7 +128,7 @@ function hideAllColumns(){
         hideAllColumns();
         e.stopPropagation();
       } else {
-        if($(this).attr("checked")){
+        if($(this).prop("checked")){
           showColumn(num);
         } else {
           hideColumn(num);
index 3a35fba..2d85c81 100644 (file)
@@ -1,10 +1,10 @@
 $(document).ready(function() {
     $("#CheckAllExports").on("click",function(){
-        $(".export:visible").attr("checked", "checked" );
+        $(".export:visible").prop("checked", true);
         return false;
     });
     $("#UncheckAllExports").on("click",function(){
-        $(".export:visible").removeAttr("checked");
+        $(".export:visible").prop("checked", false);
         return false;
     });
 
@@ -72,7 +72,7 @@ $(document).ready(function() {
 });
 
 function export_checkouts(format) {
-    if ($("input:checkbox[name='biblionumbers'][checked]").length < 1){
+    if ($("input:checkbox[name='biblionumbers']:checked").length < 1){
         alert(MSG_EXPORT_SELECT_CHECKOUTS);
         return;
     }
@@ -80,9 +80,9 @@ function export_checkouts(format) {
     $("input:checkbox[name='biblionumbers']").each( function(){
         var input_item = $(this).siblings("input:checkbox");
         if ( $(this).is(":checked") ) {
-            $(input_item).attr("checked", "checked");
+            $(input_item).prop("checked", true);
         } else {
-            $(input_item).attr("checked", "");
+            $(input_item).prop("checked", false);
         }
     } );
 
index b40da8b..90e9342 100644 (file)
             }
         } );
 
-        $("input:checkbox").attr("checked", false);
+        $("input:checkbox").prop("checked", false);
         $("div.biblio.unselected select").attr("disabled", false);
         $("div.biblio.unselected input").attr("disabled", false);
 
index 9032f83..16213b5 100644 (file)
@@ -28,7 +28,7 @@
             updateColumnsVisibility($(this).is(":checked"));
         });
 
-        $("#show_all_details").attr('checked', false);
+        $("#show_all_details").prop('checked', false);
         updateColumnsVisibility(false);
         [% UNLESS ( closedate ) %]
             $('#addtoBasket').on('show', function () {
index 0d68c3f..8f8a317 100644 (file)
@@ -47,7 +47,7 @@
             updateColumnsVisibility( $(this).is(":checked") );
         });
 
-        $("#show_all_details").attr('checked', false);
+        $("#show_all_details").prop('checked', false);
         updateColumnsVisibility(false);
     });
 //]]>
index c5f386d..ede13b9 100644 (file)
@@ -18,10 +18,10 @@ $(document).ready(function() {
         ]
     }));
 
-    $("#show_only_subscription").attr("checked", false);
+    $("#show_only_subscription").prop("checked", false);
 
     $("#show_only_subscription").click(function(){
-        if ( $(this).attr("checked") ) {
+        if ( $(this).prop("checked") ) {
             resultst.fnFilter( "1", 0, true );
         } else {
             resultst.fnFilter( '', 0 );
index 9a75de8..7404de4 100644 (file)
@@ -29,7 +29,7 @@
         $("#show_only_renewed").click(function(){
             updateRowsVisibility( $(this).is(":checked") );
         });
-        $("#show_only_renewed").attr('checked', false);
+        $("#show_only_renewed").prop('checked', false);
         updateRowsVisibility(false);
 
         $("#advsearch_form").show();
index 31b08c5..c229aa2 100644 (file)
 
         function CheckNItems(n) {
             $("input[name='items_to_receive']").each(function() {
-                $(this).attr('checked', false);
+                $(this).prop('checked', false);
             });
             $("input[name='items_to_receive']:lt("+n+")").each(function () {
-                $(this).attr('checked', true);
+                $(this).prop('checked', true);
             });
         }
     [% END %]
index dbaa574..2a62288 100644 (file)
@@ -125,8 +125,8 @@ function delete_contact(ev) {
     $('body').on('click', '.delete-contact', null, delete_contact);
     $('#add-contact').click(add_contact);
     $('body').on('click', '.contact_acqprimary', null, function () {
-        if ($(this).attr('checked') === 'checked') {
-            $('.contact_acqprimary').filter(':checked').not(this).removeAttr('checked');
+        if ($(this).is(':checked')) {
+            $('.contact_acqprimary').filter(':checked').not(this).prop('checked', false);
             $('.contact_acqprimary_hidden').each(function () {
                 $(this).val('0');
             });
@@ -134,19 +134,19 @@ function delete_contact(ev) {
         $(this).next('.contact_acqprimary_hidden').val('1');
     });
     $('body').on('click', '.contact_serialsprimary', null, function () {
-        if ($(this).attr('checked') === 'checked') {
-            $('.contact_serialsprimary').filter(':checked').not(this).removeAttr('checked');
+        if ($(this).is(':checked')) {
+            $('.contact_serialsprimary').filter(':checked').not(this).prop('checked', false);
             $('.contact_serialsprimary_hidden').each(function () {
                 $(this).val('0');
             });
         }
-        $(this).next('.contact_serialsprimary_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0');
+        $(this).next('.contact_serialsprimary_hidden').val($(this).is(':checked') ? '1' : '0');
     });
     $('body').on('click', '.contact_claimacquisition', null, function () {
-        $(this).next('.contact_claimacquisition_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0');
+        $(this).next('.contact_claimacquisition_hidden').val($(this).is(':checked') ? '1' : '0');
     });
     $('body').on('click', '.contact_claimissues', null, function () {
-        $(this).next('.contact_claimissues_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0');
+        $(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0');
     });
  });
 //]]>
index 27d353d..b9ebb9e 100644 (file)
@@ -47,7 +47,7 @@
                 hideAllColumns();
                 e.stopPropagation();
             } else {
-                if($(this).attr("checked")){
+                if($(this).prop("checked")){
                     showColumn(num);
                 } else {
                     hideColumn(num);
index 8c39742..1a9115f 100644 (file)
@@ -17,7 +17,7 @@
             $("#active").removeAttr('disabled');
             $("#hint").html("");
         } else {
-            $("#active").removeAttr('checked');
+            $("#active").prop('checked', false);
             $("#active").attr('disabled','disabled');
             $("#hint").html(_("The active currency must have a rate of 1.0"));
         }
index bdac04b..800b6c6 100644 (file)
@@ -17,7 +17,7 @@ function clear_edit(){
             $(this).removeAttr("disabled");
         }
         if ( type == "checkbox" ) {
-            $(this).attr('checked', false);
+            $(this).prop('checked', false);
         }
     });
     $(edit_row).find("select").removeAttr("disabled");
@@ -64,7 +64,7 @@ $(document).ready(function() {
                 } else if ( i == 12 ) {
                     // specific processing for cap_fine_to_replacement_price
                     var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
-                    $('#cap_fine_to_replacement_price').attr('checked', cap_fine_to_replacement_price.is(':checked') );
+                    $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
                     $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
                 } else {
                     $(current_column).find("input[type='text']").val(itm);
index 8da2fff..17022df 100644 (file)
@@ -95,12 +95,12 @@ function verify_images() {
 
     [% IF StaffDetailItemSelection %]
         function selectAllItems(div) {
-            $("input[name='itemnumber'][type='checkbox']", div).attr('checked', 'checked');
+            $("input[name='itemnumber'][type='checkbox']", div).prop('checked', true);
             itemSelectionBuildActionLinks(div);
         }
 
         function clearAllItems(div) {
-            $("input[name='itemnumber'][type='checkbox']", div).removeAttr('checked');
+            $("input[name='itemnumber'][type='checkbox']", div).prop('checked', false);
             itemSelectionBuildActionLinks(div);
         }
 
index c722cef..6e71a41 100644 (file)
@@ -204,10 +204,10 @@ function highlightOn() {
 }[% END %]
 
 function selectAll () {
-    $(".selection").attr("checked", "checked");
+    $(".selection").prop("checked", true);
 }
 function clearAll () {
-    $(".selection").removeAttr("checked");
+    $(".selection").prop("checked", false);
 }
 function placeHold () {
     var checkedItems = $(".selection:checked");
index 1572d13..f21a923 100644 (file)
@@ -111,8 +111,8 @@ $(document).ready(function(){
 
     // Check all checkboxes in first tab, and uncheck all others to avoid
     // inconsistencies from a page refresh.
-    $('#tabs div#tabrecord[% ref_biblionumber %]').find('input[type="checkbox"]').attr('checked', true);
-    $('#tabs > div:not("#tabrecord[% ref_biblionumber %]")').find('input[type="checkbox"]').removeAttr('checked');
+    $('#tabs div#tabrecord[% ref_biblionumber %]').find('input[type="checkbox"]').prop('checked', true);
+    $('#tabs > div:not("#tabrecord[% ref_biblionumber %]")').find('input[type="checkbox"]').prop('checked', false);
 
     //Set focus to cataloging search
     $("input[name=q]:eq(0)").focus();
index c671e24..55ded55 100644 (file)
@@ -64,7 +64,7 @@ columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'issues
 
 // On-site checkout
 function toggle_onsite_checkout(){
-    if ( $("#onsite_checkout").attr('checked') ) {
+    if ( $("#onsite_checkout").prop('checked') ) {
         $("#duedatespec").val("[% todaysdate | $KohaDates with_hours => 1%]")
         [% IF !Koha.Preference('SpecifyDueDate') %]
             $("#duedatespec").datetimepicker('destroy');
@@ -120,7 +120,7 @@ $(document).ready(function() {
         $('#table_borrowers tbody tr').removeClass('selected');
         $(this).addClass('selected');
         if (event.target.type !== 'radio') {
-            $(':radio', this).attr('checked', 'true')
+            $(':radio', this).prop('checked', 'true')
         }
     });
 
index 00591c7..cc831c1 100644 (file)
@@ -103,7 +103,7 @@ $(document).ready(function () {
         $("#barcode").focus();
     });
     [% IF(overduecharges) %] $("#barcode").focus(function () {
-        if (($("#exemptcheck").attr("checked") == true) || ($("#dropboxcheck").attr("checked") == true)) {
+        if (($("#exemptcheck").prop("checked") == true) || ($("#dropboxcheck").prop("checked") == true)) {
             $("#barcode").addClass("alert");
         } else {
             $("#barcode").removeClass("alert");
index 3dc62ab..37fa3f2 100644 (file)
@@ -18,7 +18,7 @@
             $('input[name="flag"]').each(function() {
                 if($(this).attr('id') != "flag-0"){
                     $(this).attr('disabled', 'disabled');
-                    $(this).removeAttr('checked', 'checked');
+                    $(this).prop('checked', false);
                 }
             });
         }
@@ -28,7 +28,7 @@
                 $('input[name="flag"]').each(function() {
                     if($(this).attr('id') != "flag-0"){
                         $(this).attr('disabled', 'disabled');
-                        $(this).removeAttr('checked', 'checked');
+                        $(this).prop('checked', false);
                     }
                 });
             }
index e15c01c..77b4df9 100644 (file)
@@ -1102,15 +1102,15 @@ function select_user(borrowernumber, borrower) {
                             var transports = ['email', 'rss', 'sms'];
                             $.each(transports, function(j, transport) {
                                 if (item['transports_' + transport] == 1) {
-                                    $('#' + transport + attrid).attr('checked', 'checked');
+                                    $('#' + transport + attrid).prop('checked', true);
                                 } else {
-                                    $('#' + transport + attrid).removeAttr('checked');
+                                    $('#' + transport + attrid).prop('checked', false);
                                 }
                             });
                             if (item.digest && item.digest != ' ') {
-                                $('#digest' + attrid).attr('checked', item.digest);
+                                $('#digest' + attrid).prop('checked', true);
                             } else {
-                                $('#digest' + attrid).removeAttr('checked');
+                                $('#digest' + attrid).prop('checked', false);
                             }
                             if (item.takes_days == '1') {
                                 $('[name=' + attrid + '-DAYS]').val('' + item.days_in_advance);
index 4916d9e..75b217f 100644 (file)
                 });
                 var selectFieldNames = ["field_1","field_2","field_3"];
                 for (var i=0; i < selectFieldNames.length; i++) {
-                    Go($("#"+selectFieldNames[i]+"_enable").attr("checked"), selectFieldNames[i]+"_select");
+                    Go($("#"+selectFieldNames[i]+"_enable").prop("checked"), selectFieldNames[i]+"_select");
                 }
                 $("#field_1_enable").change(function(){
-                    $(".field_1_enable").html(Go($(this).attr("checked"), 'field_1_select'));
+                    $(".field_1_enable").html(Go($(this).prop("checked"), 'field_1_select'));
                 });
                 $("#field_2_enable").change(function(){
-                    $(".field_2_enable").html(Go($(this).attr("checked"), 'field_2_select'));
+                    $(".field_2_enable").html(Go($(this).prop("checked"), 'field_2_select'));
                 });
                 $("#field_3_enable").change(function(){
-                    $(".field_3_enable").html(Go($(this).attr("checked"), 'field_3_select'));
+                    $(".field_3_enable").html(Go($(this).prop("checked"), 'field_3_select'));
                 });
                 $("#barcode_print").load(barcode_text('barcode_param'));
                 $("#barcode_print").change(function(){
                 });
             function barcode_text(division) {
                 var eBarcode = document.getElementById(division);
-                if( $("input[name=barcode_print]:checked").attr("checked") ) {
+                if( $("input[name=barcode_print]:checked").prop("checked") ) {
                     eBarcode.style.display = 'block';
                 } else {
                     eBarcode.style.display = 'none';
-                    $('input[name=barcode_text_print]').removeAttr('checked');
+                    $('input[name=barcode_text_print]').prop('checked', false);
                 }
             }
             function getUnit(unit){
index 546dea9..8fddf05 100644 (file)
@@ -13,7 +13,7 @@
             $("#deldateTo").attr('disabled', false);
         } else {
             $("#removeddatetr").hide();
-            $("input[value='deleteditems.timestamp']").attr('disabled', true).attr('checked', false);
+            $("input[value='deleteditems.timestamp']").attr('disabled', true).prop('checked', false);
             $("#deldateFrom").attr('disabled', true).val('');
             $("#deldateTo").attr('disabled', true).val('');
         }
index 0d9db14..91a785f 100644 (file)
@@ -182,12 +182,12 @@ $("#delColumn").on("click",function(){
 
 [% IF (create || editsql || save) %]
     $("#select_group").change(function() {
-        if($(this).attr('checked')) {
+        if($(this).prop('checked')) {
             $("#group_input").attr('disabled', 'disabled');
             $("#groupdesc_input").attr('disabled', 'disabled');
             $("#group_select").attr('disabled', false);
             if ($("#group_select").val().length > 0) {
-                $("#select_subgroup").attr('checked', 'checked');
+                $("#select_subgroup").prop('checked', true);
                 $("#select_subgroup").change();
                 $("#subgroup, #subgroup *").show();
             } else {
@@ -196,11 +196,11 @@ $("#delColumn").on("click",function(){
         }
     });
     $("#create_group").change(function() {
-        if($(this).attr('checked')) {
+        if($(this).prop('checked')) {
             $("#group_input").attr('disabled', false);
             $("#groupdesc_input").attr('disabled', false);
             $("#group_select").attr('disabled', 'disabled');
-            $("#create_subgroup").attr('checked', 'checked').change();
+            $("#create_subgroup").prop('checked', true).change();
             $("#subgroup_select").hide();
             $("#subgroup input[type='radio']").hide();
             $("#subgroup label[for]").hide();
@@ -210,14 +210,14 @@ $("#delColumn").on("click",function(){
         }
     });
     $("#select_subgroup").change(function() {
-        if($(this).attr('checked')) {
+        if($(this).prop('checked')) {
             $("#subgroup_select").attr('disabled', false);
             $("#subgroup_input").attr('disabled', 'disabled');
             $("#subgroupdesc_input").attr('disabled', 'disabled');
         }
     });
     $("#create_subgroup").change(function() {
-        if($(this).attr('checked')) {
+        if($(this).prop('checked')) {
             $("#subgroup_input").attr('disabled', false);
             $("#subgroupdesc_input").attr('disabled', false);
             $("#subgroup_select").attr('disabled', 'disabled');
index c08ba7b..c91d58f 100644 (file)
@@ -41,7 +41,7 @@ $(document).ready(function() {
         $('#table_borrowers tbody tr').removeClass('selected');
         $(this).addClass('selected');
         if (event.target.type !== 'radio') {
-            $(':radio', this).attr('checked', 'true')
+            $(':radio', this).prop('checked', 'true')
         }
     });
     var my_table = $("#requestspecific").dataTable($.extend(true, {}, dataTablesDefaults, {
@@ -153,7 +153,7 @@ function checkMultiHold() {
        $("#requestany").click(function() {
                if(this.checked){
                $("input[name=checkitem]").each(function() {
-            $(this).removeAttr("checked");
+            $(this).prop("checked", false);
                });
                }
        });
@@ -165,9 +165,9 @@ function checkMultiHold() {
                        }
                });
                if(onechecked == 1){
-            $("#requestany").removeAttr("checked");
+            $("#requestany").prop("checked", false);
                } else {
-                       $("#requestany").attr("checked","checked");
+                       $("#requestany").prop("checked",true);
                }
        });
 
index 450b6c5..54a5cfb 100644 (file)
@@ -29,7 +29,7 @@
            $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>");
 
         $("#CheckAll").click(function() {
-            $("#claimst tr:visible :checkbox").attr('checked', $("#CheckAll").is(':checked'));
+            $("#claimst tr:visible :checkbox").prop('checked', $("#CheckAll").is(':checked'));
         });
 
         // Generates a dynamic link for exporting the selections data as CSV
index deed7d4..da04563 100644 (file)
         <script type="text/javascript">
         //<![CDATA[
         function Check_boxes(dow) {
-            if($(":checkbox[data-dow='"+dow+"']:first").attr("checked") == 'checked') {
+            if($(":checkbox[data-dow='"+dow+"']:first").is(':checked')) {
                 $("#predictionst :checkbox[data-dow='"+dow+"']").each(function(){
-                    $(this).attr('checked', true);
+                    $(this).prop('checked', true);
                 });
             } else {
                 $("#predictionst :checkbox[data-dow='"+dow+"']").each(function(){
-                    $(this).attr('checked', false);
+                    $(this).prop('checked', false);
                 });
             }
         }
index 98c0be9..92747b6 100644 (file)
@@ -36,7 +36,7 @@ $(document).ready(function() {
     $(".records input:checkbox[data-issues!='0']").each(function(){
       $(this).attr('title', MSG_CANNOT_BE_DELETED)
       $(this).attr('disabled', true);
-      $(this).attr('checked', false);
+      $(this).prop('checked', false);
       $(this).parents('tr').find('td').css('background-color', '#ffff99');
     });
   [% END %]
index 7e16b64..8d50d70 100644 (file)
                 }));
                 $("#selectallbutton").click(function() {
                     $("#borrowerst").find("input:checkbox").each(function() {
-                        $(this).attr("checked", true);
+                        $(this).prop("checked", true);
                     });
                     return false;
                 });
                 $("#clearallbutton").click(function() {
                     $("#borrowerst").find("input:checkbox").each(function() {
-                        $(this).attr("checked", false);
+                        $(this).prop("checked", false);
                     });
                     return false;
                 });