Reputation: 838
I am trying to get the value of data-original-title of a <pre>
element. The HTML looks like this
<pre id="pre" data-toggle="tooltip" data-placement="right" title="" data-original-title="18 Jun 2019 06:00:00 AM - 18 Jun 2019 06:30:00 AM">
<input type="radio" name="shifts[]" id="shiftsValue" class="shiftsValue" onclick="shiftCheck();" value="266930360">
sometext
<br>
</pre>
Since there are many radio buttons, I am able to get the text of the checked radio button by using the code below
var input = $('input[type=radio][class=shiftsValue]:checked').closest('pre').text();
Now I need to read the info stored in data-original-title. I use bootstrap 3.3.
How can I do that ?
Upvotes: 1
Views: 2568
Reputation: 6368
You can use the jQuery .data function.
var originalTitle = $('input[type=radio][class=shiftsValue]:checked').closest('pre').data( 'original-title' );
Upvotes: 3