Sign in to follow this  

Javascript changing A Tag content after click?

Recommended Posts

ACTIONpack    383

If you go to the "What's the difference between Organic, Eco-Sustainable & Environmental Low Impact Products?" button when you click on it and the div shows in javascript, I would like the down arrow to go up. Not sure how to do it. if you can tell me how to would be great.

http://www.romabio.com/products/

Share this post


Link to post
Share on other sites
XerXis    251

if you use jquery:

$("#linkid").click(function()

{

//do something for click

var thelink = $(this);

//do something with link, for example css background

thelink.css("background", "......");

});

ow yeah, you might want to return false to cancel the link event to the browser. Or if you have several chained events, that might or might not be fired you can use the preventdefault method.

Share this post


Link to post
Share on other sites
ACTIONpack    383

Trying to get the down arrrow to an "X". Trying to do a search on it but can't find anything on it.

Share this post


Link to post
Share on other sites
threetonesun    1,205

Here's a fiddle for it: http://jsfiddle.net/HFgFQ/

HTML:


<a href='#' id='change'>v</a>
[/CODE]

JS:

[CODE]
$('#change').click(function(){
var text = $(this).text();
text == 'v' ? $(this).text('x') : $(this).text('v');
return false;
});
[/CODE]

Share this post


Link to post
Share on other sites
ACTIONpack    383

Thanks for your help!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.