You are viewing limited content. For full access, please sign in.

Question

Question

Firefox vs. IE 11

asked on February 22, 2019

I have this code that checks or unchecks radio button depending on fields chosen earlier in the process:

$(document).ready(function(){
//Set value for Customer Approval radio button
  if($('#Field121-1').is(':checked')) //If Customer Approval = Yes
  {
    $('#Field194-0').attr('checked', false); //Customer Approval is Received must be evaluated by user
    $('#Field194-1').attr('checked', false);
    $("#Field194-1").prop("disabled", true); //Disable so it cannot be changed
  }
  else
  {
    $('#Field194-0').attr('checked', false); //Customer Approval is Not Required
    $('#Field194-1').attr('checked', true);
    $("#Field194-0").prop("disabled", true); //Disable so it cannot be changed
    $("#Field194-1").prop("disabled", true); //Disable so it cannot be changed
  }

//Set value for Licensing Review radio button
  if($('#Field18-1').is(':checked')) //If TIP 3.5 Lic Review = Yes
  {
    $('#Field195-0').attr('checked', false); //Licensing Review is Complete must be evaluated by user
    $('#Field195-1').attr('checked', false);
    $("#Field195-1").prop("disabled", true); //Disable so it cannot be changed
  }
  else
  {
    $('#Field195-0').attr('checked', false); //Licensing Review is Not Required
    $('#Field195-1').attr('checked', true);
    $("#Field195-0").prop("disabled", true); //Disable so it cannot be changed
    $("#Field195-1").prop("disabled", true); //Disable so it cannot be changed
  }

//Set value for Design Review radio button
  if($('#Field76-1').is(':checked')) //If Design Review = Yes
  {
    $('#Field196-0').attr('checked', false); //Design Review is Complete must be evaluated by user
    $('#Field196-1').attr('checked', false);
    $("#Field196-1").prop("disabled", true); //Disable so it cannot be changed
  }
  else
  {
    $('#Field196-0').attr('checked', false); //Design Review is Not Required
    $('#Field196-1').attr('checked', true);
    $("#Field196-0").prop("disabled", true); //Disable so it cannot be changed
    $("#Field196-1").prop("disabled", true); //Disable so it cannot be changed
  }

});  //close document.ready

This works great with IE 11 (Ver. 11.590.17134.0, update Ver 11.0.110):

But doesn't seem to work with Firefox (60.2.2esr, 32-bit):

Is there a workaround?

0 0

Answer

SELECTED ANSWER
replied on August 29, 2019

I see that you are using .prop() to set "disabled" and using .attr() to set "checked".  Have you tried using .prop() to set "checked" as well?

 

I read on https://api.jquery.com/prop/ that since the "disabled" and "checked" properties of checkboxes and radio buttons affects the dynamic state of a DOM element without changing the serialized HTML attribute, the .prop() method should be used to set both "disabled" and "checked" instead of the .attr() method.

2 0

Replies

replied on August 28, 2019

Did you get  a solution for this?

0 0
replied on August 29, 2019

Sadly, no.

0 0
SELECTED ANSWER
replied on August 29, 2019

I see that you are using .prop() to set "disabled" and using .attr() to set "checked".  Have you tried using .prop() to set "checked" as well?

 

I read on https://api.jquery.com/prop/ that since the "disabled" and "checked" properties of checkboxes and radio buttons affects the dynamic state of a DOM element without changing the serialized HTML attribute, the .prop() method should be used to set both "disabled" and "checked" instead of the .attr() method.

2 0
replied on August 29, 2019 Show version history

Thank you, Bert! Ended up using both the prop and the attr.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.