/    Sign up×
Community /Pin to ProfileBookmark

Hide button once clicked

How can i hide a button when i click it?

to post a comment
JavaScript

10 Comments(s)

Copy linkTweet thisAlerts:
@WolfShadeDec 27.2010 — Give it the following parameter.
<i>
</i>onClick = "this.style.visibility= 'hidden';"

Once clicked it will disappear and will not re-appear unless the page is reloaded.

^_^
Copy linkTweet thisAlerts:
@jojo13authorDec 27.2010 — Give it the following parameter.
<i>
</i>onClick = "this.style.visibility= 'hidden';"

Once clicked it will disappear and will not re-appear unless the page is reloaded.

^_^[/QUOTE]


thanks,it works but i have a problem.I have already set something at the onclick.How can i have 2 different codes on the same part?
Copy linkTweet thisAlerts:
@WolfShadeDec 27.2010 — onClick = "this.style.visibility='hidden'; [other onclick event];"

Be sure to have each call end with a semi-colon.

^_^
Copy linkTweet thisAlerts:
@jojo13authorDec 27.2010 — onClick = "this.style.visibility='hidden'; [other onclick event];"

Be sure to have each call end with a semi-colon.

^_^[/QUOTE]


Get my code because it doesn't work for me

onClick="loadWholePage('/5/1.html'); this.style.visibility= 'hidden';" >

When i press the button it loads an external page and i want to disappear the button.But this code i wrote doesn't disappear the button.
Copy linkTweet thisAlerts:
@WolfShadeDec 27.2010 — Because you're calling the other function before hiding the button. Hide the button, first.

^_^
Copy linkTweet thisAlerts:
@jojo13authorDec 27.2010 — Because you're calling the other function before hiding the button. Hide the button, first.

^_^[/QUOTE]


Oh,thank you very very much.It worked!
Copy linkTweet thisAlerts:
@WolfShadeDec 27.2010 — Another option would be to just call the function in the onClick, and add the CSS manipulation as the first line of the function.

^_^
Copy linkTweet thisAlerts:
@jojo13authorDec 27.2010 — Another option would be to just call the function in the onClick, and add the CSS manipulation as the first line of the function.

^_^[/QUOTE]


basically now as i watch the result,i see that when the button disappears there is a large blank.Is it possible to fix this blank?
Copy linkTweet thisAlerts:
@WolfShadeDec 27.2010 — "Large blank"?

If you mean that there is a gap where the button used to be and content below it does not move up and close the gap, I did it that way intentionally.

If you want there to be no gap, then change the onClick to
<i>
</i>onClick = "this.style.[color=red]display='none'[/color]; [other onclick event];"


^_^
Copy linkTweet thisAlerts:
@jojo13authorDec 27.2010 — "Large blank"?

If you mean that there is a gap where the button used to be and content below it does not move up and close the gap, I did it that way intentionally.

If you want there to be no gap, then change the onClick to
<i>
</i>onClick = "this.style.[color=red]display='none'[/color]; [other onclick event];"


^_^[/QUOTE]


for one more time thanks alot!It worked
×

Success!

Help @jojo13 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 5.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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...