Reputation: 16651
HTML
<a href="#" id="popp" name="popo" class="tooltipLink">
<img src="images/information.png" alt="info" />
<span class="tipp"></span>
</a>
jQuery
var text = blah;
$('#popo span').text(text);
The text is not setting...I am doing something wrong..?
Upvotes: 1
Views: 438
Reputation: 1038720
You probably meant:
var text = 'blah';
$('#popp span').text(text);
as seen in this live demo.
Things to notice:
blah
is wrapped inside quotes as it represents a string#popp
instead of #popo
as id selectorUpvotes: 0
Reputation: 943157
text
which is a copy of blah
which is undefined
Upvotes: 0
Reputation: 66389
Typo and lack of quotes.. this will work:
var text = "blah";
$('#popp span').text(text);
First, by having this: var text = blah;
you assigned the text as undefined variable and second you used the name instead of the ID of the anchor.
Upvotes: 2