/    Sign up×
Community /Pin to ProfileBookmark

check box controlling a text area

Hello,
I would like to have a check box that when checked, will add some text into a text area. (And remove the text if the box is unchecked.)I can’t seem to figure out how. Can someone please help?

Thank you!
Steve

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@ai3rulesJan 08.2005 — Try something like this:

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<script language="javascript">

<!--

function addText(){

var text = "text to put in textarea"

if(document.form1.check1.checked){

document.form1.textarea1.value = text

}

else{

document.form1.textarea1.value = ""

}

}

//-->

</script>

</head>

<body>

<form name="form1">

<input type="checkbox" name="check1" onpropertychange="addText()">

<textarea cols="30" rows="10" name="textarea1"></textarea>

</form>

</body>

</html>
Copy linkTweet thisAlerts:
@balloonbuffoonauthorJan 08.2005 — Thank you, it works great! ?

Have a nice day!

Steve
×

Success!

Help @balloonbuffoon 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.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

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