Solved

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

Posted on 2016-09-29
4
84 Views
Last Modified: 2016-09-30
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
0
Comment
Question by:Eduardo Fuerte
  • 2
4 Comments
 

Author Comment

by:Eduardo Fuerte
ID: 41821858
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
0
 
LVL 54

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 41823083
var serv = $( "#houve_custo option:selected" ).text();

Open in new window

You can also do
var serv = $( "#houve_custo" ).val();

Open in new window

0
 

Author Closing Comment

by:Eduardo Fuerte
ID: 41823300
Thanks !
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question