9

I have a button code which someone created it. Here are the button code:

<button class="demo btn btn-primary" data-toggle="modal" href="#long"  onClick="javascript:add();"><i class="icon-plus-sign icon-white"></i> Add Employee</button>

I've edit the function related to the button (send the new data from the button, and call it in the function), but nothing happened. Then I tried to delete data-toggle="modal", the pop up didn't show. So, I wonder, what is data-toggle="modal" use for?

I thought here are the link to modal:

<script src="js/bootstrap-modalmanager.js"></script>
<script src="js/bootstrap-modal.js"></script>

Can anyone explain me about data-toggle="modal"? Thank you.

Dan
  • 9,391
  • 5
  • 41
  • 73
Lupita Noyra
  • 221
  • 2
  • 3
  • 12

1 Answers1

20

From the Bootstrap Docs

<!--Activate a modal without writing JavaScript. Set data-toggle="modal" on a 
controller element, like a button, along with a data-target="#foo" or href="#foo" 
to target a specific modal to toggle.-->

<button type="button" data-toggle="modal" data-target="#myModal">Launch modal</button>
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Dan
  • 9,391
  • 5
  • 41
  • 73