Solved

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

Posted on 2016-09-29
4
67 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
Comment Utility
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 51

Accepted Solution

by:
Julian Hansen earned 500 total points
Comment Utility
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
Comment Utility
Thanks !
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
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 how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now