I
I
Ivan Fotiev2015-11-20 12:47:34
JavaScript
Ivan Fotiev, 2015-11-20 12:47:34

How to overcome the Firefox bug with cheked?

Hello, I've run into this problem. There is a site on 1C-Bitrix, one of the pages has a smart filter.
Sample Markup

<div class="color_f">
<label data-role="label_<?=$ar["CONTROL_ID"]?>" class="color_box ch_box">
  <input
  style="display:none;"
  type="radio"
  class="ch_input"
  value="<? echo $ar["HTML_VALUE_ALT"] ?>"
  name="<? echo $ar["CONTROL_NAME_ALT"] ?>"
  id="<? echo $ar["CONTROL_ID"] ?>"
  <? echo $ar["CHECKED"]? 'checked="checked"': '' ?>
  />
    <span style="background: <?=$ar["VALUE"];?>" class="bg_color">&nbsp;</span>
  </label>
</div>

JS
BX.addCustomEvent('onAjaxSuccess', function(data){
  var count_color = $('.color_f :radio:checked').length;
  var count_section = $('.section_f :radio:checked').length;
  if (count_color > 0) {
    $('.all_colors').addClass('underline');
  }
  if (count_section > 0) {
    $('.all_section').addClass('underline');
  }

  $(".color_f .ch_input:checked").parent().addClass("active");
})

On click, the class is applied to the label, everything works in chrome and opera, BUT in firefox, checked="checked" is not substituted for the selected input and the class is not applied to the label.
How can you overcome this?)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2015-11-20
@xmoonlight

F12 and find the problem!)

I
Ivan Fotiev, 2015-11-20
@ifotev

I figured out the problem, Bitrix was to blame)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question