jquery ::: replace hyperlink text?

html, jquery, replace

Solution

You have one additional bracket and the assignment is wrong.

if($j("a").text() == 'Contact') {
   $j("a").text('Connect');
}

instead of

if($j("a").text() == 'Contact')) {
   $j("a").text() == 'Connect');
}

Looks like you just copied and pasted the code from the condition and changed `Contact` to `Connect`. Be careful with that.

Problem

Just trying to replace the hyperlink text and I'm not finding a way to do this... I tried the code below, but, I get a syntax error? EDIT ``` <script type="text/javascript"> var $j = jQuery.noConflict(); $j(function() { if($j("a").text() == "Contact") { $j("a").text() = "Connect"); } }); </script> ```

Original source