/    Sign up×
Community /Pin to ProfileBookmark

Working with checkboxes

Hi all.

First I’ve got to say I’m COMPLITILY BEGGINER in JavaScript

What code would it be that does folowing:

If checkbox with “name” is true input textfied named “name” near checkbox

If checkbox with “name” is false delete textfied from above

If somebody could help me please. I’ve stuckt with this stupid problem

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@KorApr 17.2004 — Try this:

[code=php]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script>
function bla(f){
if(f.ch.checked){document.getElementById('tx').style.display='inline'}
else{document.getElementById('tx').style.display='none'}
}
</script>
</head>

<body>
<form>
<input name="ch" type="checkbox" onclick="bla(this.form)"><input id="tx" type="text" style="display:none">
</form>
</body>
</html>
[/code]
×

Success!

Help @ddragas 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.21,
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,
)...