Reputation: 536
Hi i have dynamically added list of links and title is added to the link but some of the link are add empty titles so i need to add a default title using JavaScript
<a class="tip visible-phone" data-original-title=" " href="#" data-toggle="tooltip" data-placement="right" title="">view</a>
Upvotes: 0
Views: 866
Reputation: 26143
This should do what you need...
$("a[data-original-title=' ']").data("original-title", "default title");
or...
$("a[title='']").attr("title", "default title");
depending on whether it's the title attribute, or data-original-title.
Just add that line of code after you have dynamically created the links.
Upvotes: 4