Question: I have a button that toggles a bootstrap modal.

```
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">

```

I want to do the same thing with a jquery function. Is this possible?

Answer: 
With simple code like you posted:

```
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">

```

It won't show modal dialog unless you write code in javascript like:

```
$("button").on("click", function(){
  $($(this).attr("data-target")).modal("show");
});

```

And what you will put in `data-target` will open a div with id as dialog modal.

or

```
$("button").on("click", function(){
  $($(this).data("target")).modal("show");
});

```
Just a simple `$("#myModal").modal()` in any function of your choice