Forum Moderators: open

Message Too Old, No Replies

jquery replace href contents

         

surrealillusions

7:02 pm on Jun 23, 2010 (gmt 0)

10+ Year Member



Hi all,

Would like to be able to replace the contents of the href attribute of one link on the page.

Have searched around Google and came across this:

$(document).ready(function(){
$("a#open").attr("href", "#");
)}

With the link been this:

<a id="open" class="open" href="contact.php">Open</a>

But it doesn't work. There were other variants of the jquery code but they also failed to work. I cant see why this doesn't work.

Any suggestions? I would like to replace the 'contact.php' with a #

Fotiman

7:19 pm on Jun 23, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The order of your closing ) and } are incorrect. You have this:
)}
Should be this:
});

Give that a try and see if it fixes the problem.

surrealillusions

11:39 am on Jun 24, 2010 (gmt 0)

10+ Year Member



Ah, that was it, thanks :)