Caner
Caner

Reputation: 873

passing a parameter to modal in bootstrap

I have 2 pages, for example

index.html
remote-content.html

in Index.html

<a class="btn btn-primary" href="/List/remote-content.html" data-controlId="AccountId" data-toggle="modal" data-target="#modal" type="button"><i class="fa fa-search"></i></a>

How can I access data-controlId="AccountId" from remote-content.html when modal when loaded?

Upvotes: 0

Views: 108

Answers (2)

Caner
Caner

Reputation: 873

Can I access this way.

$(document).ready(function () {
    var controlId = $("#button", parent.document).attr("data-controlId");
});

Upvotes: 1

Sterling
Sterling

Reputation: 332

Using jQuery, you can access data- attributes with the .data() method on a jQuery object.

Upvotes: 1

Related Questions