6 Replies - 855 Views - Last Post: 25 June 2013 - 07:37 PM

#1 Murillio4  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-June 13

how can i call a dropdown with a function?

Posted 25 June 2013 - 06:06 PM

Hi how can i call this dropdown with a function instead of the button?

<div class="dropdown">
     <a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown trigger</a>
       <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
     <li><a href="#">Item</a>
    </ul>
  </div>


Is This A Good Question/Topic? 0
  • +

Replies To: how can i call a dropdown with a function?

#2 JMRKER  Icon User is offline

  • D.I.C Addict

Reputation: 128
  • View blog
  • Posts: 827
  • Joined: 25-October 08

Re: how can i call a dropdown with a function?

Posted 25 June 2013 - 06:19 PM

Show some more of your code.

Where is your dropdown defined?
What do the CSS styles look like?
You only have one item in the <ul> list?
Organization of the HTML portion?

:helpsmilie:/> us :helpsmilie:/> you.
Was This Post Helpful? 0
  • +
  • -

#3 Murillio4  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-June 13

Re: how can i call a dropdown with a function?

Posted 25 June 2013 - 06:38 PM

This is how it's runned now:
<a href="#nda" data-toggle="modal" class="btn btn-primary btn-large"><i class="icon-align-left"></i> Read the NDA</a>


but this is an example how i want it to run:

<a oclick="dropdown()" class="btn btn-primary btn-large"><i class="icon-align-left"></i> Read the NDA</a>


and then some javascript code to do the function...

<div id="nda" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
    <h3 id="myModalLabel">Declaration of confidentiality</h3>
  </div>
  <div class="modal-body">
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis, dolor, asperiores fugiat nulla assumenda quasi eligendi vero voluptatibus dignissimos eaque totam veritatis officia doloribus odio fuga esse dolore! Cum, recusandae?</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, facere, officiis obcaecati recusandae omnis sunt quis porro sequi perspiciatis labore reiciendis ducimus ex quod expedita esse voluptas minima! Aperiam, quam!</p>
  </div>
  <div class="modal-footer">
    <button class="btn btn-primary btn-large" data-dismiss="modal" aria-hidden="true">Close</button>
  </div>
</div>

Was This Post Helpful? 0
  • +
  • -

#4 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 439
  • View blog
  • Posts: 1,865
  • Joined: 30-April 10

Re: how can i call a dropdown with a function?

Posted 25 June 2013 - 06:58 PM

What do you want the function to do?

Do you want it to show content that is hidden?

This post has been edited by laytonsdad: 25 June 2013 - 07:15 PM

Was This Post Helpful? 0
  • +
  • -

#5 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 439
  • View blog
  • Posts: 1,865
  • Joined: 30-April 10

Re: how can i call a dropdown with a function?

Posted 25 June 2013 - 07:17 PM

Where is the existing javascript?
Was This Post Helpful? 0
  • +
  • -

#6 Murillio4  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 25-June 13

Re: how can i call a dropdown with a function?

Posted 25 June 2013 - 07:22 PM

I want the function to do this:

<div id="nda" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

  <div class="modal-header">

    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>

    <h3 id="myModalLabel">Declaration of confidentiality</h3>

  </div>

  <div class="modal-body">

    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis, dolor, asperiores fugiat nulla assumenda quasi eligendi vero voluptatibus dignissimos eaque totam veritatis officia doloribus odio fuga esse dolore! Cum, recusandae?</p>

    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, facere, officiis obcaecati recusandae omnis sunt quis porro sequi perspiciatis labore reiciendis ducimus ex quod expedita esse voluptas minima! Aperiam, quam!</p>

  </div>

  <div class="modal-footer">

    <button class="btn btn-primary btn-large" data-dismiss="modal" aria-hidden="true">Close</button>

  </div>

</div>


visible, same as this:
<a href="#nda" data-toggle="modal" class="btn btn-primary btn-large"><i class="icon-align-left"></i> Read the NDA</a>
does, if u understand. I've not created the javascript
Was This Post Helpful? 0
  • +
  • -

#7 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 439
  • View blog
  • Posts: 1,865
  • Joined: 30-April 10

Re: how can i call a dropdown with a function?

Posted 25 June 2013 - 07:37 PM

I don't know what your CSS looks like but I am going to guess that you have the id=nda div hidden and you want to show it using the link with the href of #nda? is this correct?

If the above is correct you can:

Create a function to use when the link is clicked
In the function you will then select the element you want to show with the id document.getElementById('yourElementId').style.display = "block" This will show the element that is hidden in your css as a block element.


Or you could use jQuery, But you will need to understand a great deal of Javascript first.

My suggestion is to read a book about Javascript or find a tutorial site. see my signature for the MDN site.

This post has been edited by laytonsdad: 25 June 2013 - 07:47 PM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1