Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #40375
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Arno Welzel <usenet@arnowelzel.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: changing the value of a text box with .js |
| Date | Mon, 6 Sep 2021 15:09:43 +0200 |
| Lines | 27 |
| Message-ID | <ipmi8nF3c0vU1@mid.individual.net> (permalink) |
| References | <sh31k5$167f$1@gioia.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net URrBPmcvmS/wJcvvYP9TegQFRDf8w3q/wMKzgEUFJeFGA70F0/ |
| Cancel-Lock | sha1:K+Iu73983gAH5CM+uQn/hx6XkHA= |
| In-Reply-To | <sh31k5$167f$1@gioia.aioe.org> |
| Xref | csiph.com comp.lang.javascript:40375 |
Show key headers only | View raw
bill:
> I know how to change the value of a span or div using:
> onClick= document.getElementById("searchkey").value = "type min 3
> letters";
<span> or <div> don't have a value. What are you talking about?
> but that does not work for an input type=text element.
>
> What is the proper way to do that?
Using "value" is totally fine:
<input type="text" id="foobar" name="foobar">
<script>
document.getElementById("foobar").value="test";
</script>
However - where exactly do you use "onClick" and did you define
"searchkey" as *id* and not only as name?
--
Arno Welzel
https://arnowelzel.de
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
changing the value of a text box with .js bill <william@TechServSys.com> - 2021-09-05 14:17 -0400
Re: changing the value of a text box with .js Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-09-05 22:44 +0000
Re: changing the value of a text box with .js JJ <jj4public@gmail.com> - 2021-09-06 14:39 +0700
Re: changing the value of a text box with .js Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-09-17 00:46 +0200
Re: changing the value of a text box with .js Arno Welzel <usenet@arnowelzel.de> - 2021-09-06 15:09 +0200
csiph-web