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");
});

```
Maybe you should read [this explanation](http://www.marcofolio.net/webdesign/html5_data-_attributes_are_great_and_you_know_it.html) about the "data-" html5 attribute.

You can define custom data- attributes and use them when developing your plugins.

This is what bootstrap did.

If you want to use it in JQuery to show a modal dialog - you should write a plugin similar to what bootstrap did. 

I suggest you read bootstrap's source code and see how they used this attribute.