M
M
mills2019-09-27 07:40:17
JavaScript
mills, 2019-09-27 07:40:17

After refreshing the page, the class is attached, how to get rid of it?

Hi everyone
script

$( "#form_dropdown_location" ).change(function(){
      if( $(this).val() === "769" ) {
          $( ".aleksandriysk" ).removeClass("hidden");
      }
      else {
        $( ".aleksandriysk" ).addClass("hidden");
      }
       });


When choosing in select with valut 769, a new select appears ...
After saving and updating page 1 select everything is OK, but the class hidden is still attached to the second one and it is not shown how to make the check easier or not to attach more hidden if a choice is made?

I hope I explained clearly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arthur, 2019-09-27
@mills

If I understood correctly, then add the code below your function
$( "#form_dropdown_location" ).trigger('change')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question