I have a table with a link in a cell of the table like this: & lt; Data-Toggle = "Model" Data-id = "XIs" href = "# RemoteModel" Data-Target = "#Remote" and gt; SOME_TEXT & lt; / A & gt; . When I click on this link, then I should open a model here is an example:
The modal should do some operations which depend on the value of the "Data-ID" attribute. To be accurate, I need to read this value in the Javascript code:
& lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ('# remoteModal'). ('Show.bs.modal', function) {console.log (/ * How do I read the data-id value? * / );});});
I do not know how to read the value of this attribute in the JavaScript code of the model.
Many thanks for your interest.
Use the mentioned in event docs:
$ (document) ) .ready (function () {$ ('# remotemodal'). ('Show.bs.modal', function (event) {console.log ($ (event.relatedTarget) .attr ('data-id')) ;});});
Comments
Post a Comment