Avatar of Eduardo Fuerte
Eduardo Fuerte
Flag for Brazil asked on

Could you point a way to hide/show a division under circunstaces by using Bootstrap?

Hi Experts

Could you point a way to hide/show  a division  under circunstaces by using Bootstrap?

 Accordingly to:
img001
By fiiling Houve Custo with Sim (Yes) the element Custo and the division with the 02 elements
Houve Reembolso?  and Reembolso must appear.

  <!-- EF Set/2016  - div-->
                                    <div id="divReembolso" class="hide">
                                    <div class="row">         
                                        <!-- EF Set/2016  - Houve Reembolso?-->
                                        <div class="col-xs-4 mb20">
                                            <label for="houve_reembolso" class="field-label text-muted mb10">Houve Reembolso?</label>
                                            <label for="houve_reembolso" class="validar field select">
                                                <select name="houve_reembolso" id='houve_reembolso'>
                                                    <option value="">Selecione ...</option>
                                                    <option value="S">Sim</option>
                                                    <option value="N">Não</option>
                                                </select>
                                            </label>
                                        </div>
                                         <!-- EF Set/2016 FIM  - Houve Reeembolso -->
                                   
                                    
                                 <!-- EF Set/2016  - Reembolso?-->
                                        <div class="col-xs-4 mb20 reembolso" style="display: none;">
                                            <label for="reembolso" class="field-label text-muted mb10">Reembolso</label>
                                            <div class="input-group">
                                                <span class="input-group-addon">
                                                    <i class="fa fa-money c-gray"></i>
                                                </span>
                                                <span class="validar">
                                                    <input type="text" name="reembolso" id="reembolso" class="form-control gui-input br-light light" placeholder="">
                                                </span>
                                            </div>
                                        </div>
                                    <!-- EF Set/2016 FIM  - Reeembolso -->
                                      </div>
                        
                                    </div>
                                    <!-- EF Set/2016 FIM  - div -->

Open in new window



jquery (doesn't running)

$(function () {
      

        $("#houve_custo").change(function() {
            var serv = $( "#houve_custo option:selected" ).text();

            if (serv != 'Sim')
                $(".custo").hide();
                
                //EF Set/2016
                $("#divReembolso").hide();
                //$("#divReembolso").addClass('hidden');
                //$("#houve_reembolso").hide();
                //$(".reembolso").hide();
                //EF Set/2016 - FIM
            else
                $(".custo").show();
 
                //EF Set/2016
                $("#divReembolso").removeClass('hidden');
                //$("#divReembolso").show();
               //$("#houve_reembolso").show();
                //$(".reembolso").show();
                //EF Set/2016 - FIM
        });

Open in new window


Could you point what must be changed to make it run?

Thanks in advance
BootstrapjQueryPHPJSONJavaScript

Avatar of undefined
Last Comment
Eduardo Fuerte

8/22/2022 - Mon
Eduardo Fuerte

ASKER
Sorry


I just omit the {  } in the jquery else. That's the problem.
 if (serv != 'Sim')
            {
                $(".custo").hide();
                $("#divReembolso").hide();
            }         
            else
            {
                $(".custo").show();
                $("#divReembolso").show();
            }

Open in new window

Open in new window

It runs that way
ASKER CERTIFIED SOLUTION
Julian Hansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Eduardo Fuerte

ASKER
Thanks !
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes