tags:

views:

27

answers:

2

In showComments (), an ajax call and on success i tried:

$('#showCommentLink').text("Hide");

Im trying to change the text from show all comments to "hide" without results.

<a class='showCommentLink' href='javascript:showComments($displayWall[id]);' style='cursor: pointer;'>Show all $isThereAnyComments comments</a>

Have i missed something?

+3  A: 

$('.showCommentLink') not $('#showCommentLink').

The # selector is for IDs, and the . selector is for classes.

Rocket
wow my bad, thank you
Karem
You're welcome.
Rocket
+2  A: 
$('.showCommentLink').text("Hide");

You used #, which looks for an id. "." looks for a class.

Also, you should read up on onobtrusive javascript - running that function in your href kind of defeats a major purpose of jquery!

ScottE
+1 for unobtrusive comment!
Domenic