/    Sign up×
Community /Pin to ProfileBookmark

Hiding a Span

I am trying to hide a span by clicking a button. I want the span to become visible (which it does fine), then, by clickign a button, it hides it again…however, nothing happens when i click the button, no code, and the span is still visible. here is my code:

[code]
function BlurPartSearch()
{
document.getElementById(“spanPartNumAjax2”).style.display == ‘none’;
}
[/code]

the span is this:

<span id=”spanPartNumAjax2″></span>

thanks!

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@felgallOct 29.2008 — How are you calling the function?
Copy linkTweet thisAlerts:
@dzirkelbauthorOct 29.2008 — <input type="button" style="font-family: Verdana; font-size: 8pt" value="test" onclick="BlurPartSearch()">
Copy linkTweet thisAlerts:
@astupidnameOct 30.2008 — var count = 1;

function BlurPartSearch(){

document.getElementById("spanPartNumAjax2").style.display = (count%2)?"none":"block";

count++;

}
Copy linkTweet thisAlerts:
@dzirkelbauthorOct 30.2008 — That did the trick. Thanks!
×

Success!

Help @dzirkelb 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.18,
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,
)...