Answer the question
In order to leave comments, you need to log in
'indexOf' of undefined?
I use this expression:
if ($('div a').attr('data-content').indexOf('warning') + 1) {
...
Uncaught TypeError: Cannot read property 'indexOf' of undefined
<div>
<a data-toggle="popover" data-html="true" title="Блок #1" data-content="Загрузка..."
role="button" data-placement="bottom"></a>
</div>
<div>
<a data-toggle="popover" data-html="true" title="Блок #1" data-content="<div class="info">info</div><div class="warning">info</div>"
role="button" data-placement="bottom"></a>
</div>
Answer the question
In order to leave comments, you need to log in
1) for data-attributes there is a data() method.
2) Open the console and execute the code
Make sure that it returns. data attributes are case sensitive, e.g.
3) Explain the purpose of this -
<a data-toggle="popover" data-html="true" title="Блок #1" data-content="<div class="info">info</div><div class="warning">info</div>"
role="button" data-placement="bottom"></a>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question