/    Sign up×
Community /Pin to ProfileBookmark

replaceWith issue

Hi! I’m new here in Webdevelopers.com, it seems to be a great forum! I hope I can get some help and help people out :p

I don’t know much about Java and I’m new to JQuery.

I’m creating a website and I want to replace “+ Table” for “- Table” in #button1 a when the user clicks on #table1_head.

For that I’ve used:

[CODE]$(document).ready(function () {
$(‘#table1_head’).click(function () {
$(‘#button1 a’).replaceWith(‘- Table1’);
});
});[/CODE]

It worked. But I want to replace “- Table” back to “+ Table” when the user clicks on it again. How can I do that?

Demo:
[url]http://www.teste442.xpg.com.br/example/[/url]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @eng442 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...