samedi 25 juillet 2020

JQuery automatically check a checkbox and show dropdown menu

I want to check a check box automatically and show the drop-down menu if certain condition is met.

this part of code is what I want to change. I tried this below, it checks the checkbox if that condition is met but does not show the menu if checked.

- if @tenant.enable_recording_extensions
  = check_box_tag 'recorded', 1, @user.recorded, checked: "jQuery('#Recording').fadeToggle();"

This is the full if statement

      .panel.panel-primary
        .panel-heading
          - if @tenant.enable_recording_extensions
            = check_box_tag 'recorded', 1, @user.recorded, checked: "jQuery('#Recording').fadeToggle();"
            %strong Enable
          - else
            = check_box_tag 'recorded', 1, @user.recorded, onClick: "jQuery('#Recording').fadeToggle();"
            %strong Enable



Aucun commentaire:

Enregistrer un commentaire