Ok, the title might be a little confusing. Let me explain.
<div class="book">
<h3>Name of Book</h3>
<p>
<span data-notmobile="Author"></span>Rajesh K. Maurya</p>
<p>
<span data-notmobile="Publication"></span>Wiley India</p>
<p>
<span data-notmobile="Edition"></span>2011</p>
<p>
<span data-notmobile="Branch"></span>Information Technology</p>
<p>
<span data-notmobile="Semester"></span>5</p>
</div>
Now I want a way to swap out the content of each span with its data attribute respectively. I tried
$('.book span').html($('.book span').data("notmobile"));
which only changes the inner html to the first attribute ie "Author". For some reason, the 'this' keyword does not work.
I want to do this without giving each span a class of its own.