Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Debug is human, de-fix divine.


devel / comp.lang.javascript / changing the value of a text box with .js

SubjectAuthor
* changing the value of a text box with .jsbill
+* Re: changing the value of a text box with .jsJon Ribbens
|`* Re: changing the value of a text box with .jsJJ
| `- Re: changing the value of a text box with .jsThomas 'PointedEars' Lahn
`- Re: changing the value of a text box with .jsArno Welzel

1
changing the value of a text box with .js

<sh31k5$167f$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17253&group=comp.lang.javascript#17253

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!aioe.org!0Rru9CdXXiQq2r8Rbz8z8A.user.46.165.242.75.POSTED!not-for-mail
From: william@TechServSys.com (bill)
Newsgroups: comp.lang.javascript
Subject: changing the value of a text box with .js
Date: Sun, 5 Sep 2021 14:17:41 -0400
Organization: Aioe.org NNTP Server
Message-ID: <sh31k5$167f$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="39151"; posting-host="0Rru9CdXXiQq2r8Rbz8z8A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Content-Language: en-US
X-Mozilla-News-Host: news://nntp.aioe.org:119
X-Notice: Filtered by postfilter v. 0.9.2
 by: bill - Sun, 5 Sep 2021 18:17 UTC

I know how to change the value of a span or div using:
onClick= document.getElementById("searchkey").value = "type min 3
letters";

but that does not work for an input type=text element.

What is the proper way to do that?

-bill

Re: changing the value of a text box with .js

<slrnsjai2s.78u.jon+usenet@raven.unequivocal.eu>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17254&group=comp.lang.javascript#17254

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jon+usenet@unequivocal.eu (Jon Ribbens)
Newsgroups: comp.lang.javascript
Subject: Re: changing the value of a text box with .js
Date: Sun, 5 Sep 2021 22:44:44 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <slrnsjai2s.78u.jon+usenet@raven.unequivocal.eu>
References: <sh31k5$167f$1@gioia.aioe.org>
Injection-Date: Sun, 5 Sep 2021 22:44:44 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="b43006d37b7c93aa4af6ab35524dc9f4";
logging-data="17292"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4meaf9RxH1dy5Rrq40ZDTyehtlDTgR+w="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:N/kyiUalA83uNvsXVhVzbcpav8A=
 by: Jon Ribbens - Sun, 5 Sep 2021 22:44 UTC

On 2021-09-05, bill <william@TechServSys.com> wrote:
> I know how to change the value of a span or div using:
> onClick= document.getElementById("searchkey").value = "type min 3
> letters";
>
> but that does not work for an input type=text element.
>
> What is the proper way to do that?

Did you mean that the other way around? If so you might want the
'textContent' property.

Re: changing the value of a text box with .js

<tx928w8dphta$.1jplgn5qs6ioi.dlg@40tude.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17255&group=comp.lang.javascript#17255

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!aioe.org!Jl5BM2TKAblO2M6aqRZwRw.user.46.165.242.91.POSTED!not-for-mail
From: jj4public@gmail.com (JJ)
Newsgroups: comp.lang.javascript
Subject: Re: changing the value of a text box with .js
Date: Mon, 6 Sep 2021 14:39:07 +0700
Organization: Aioe.org NNTP Server
Message-ID: <tx928w8dphta$.1jplgn5qs6ioi.dlg@40tude.net>
References: <sh31k5$167f$1@gioia.aioe.org> <slrnsjai2s.78u.jon+usenet@raven.unequivocal.eu>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="8900"; posting-host="Jl5BM2TKAblO2M6aqRZwRw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: 40tude_Dialog/2.0.15.84
X-Notice: Filtered by postfilter v. 0.9.2
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
 by: JJ - Mon, 6 Sep 2021 07:39 UTC

On Sun, 5 Sep 2021 22:44:44 -0000 (UTC), Jon Ribbens wrote:
> On 2021-09-05, bill <william@TechServSys.com> wrote:
>> I know how to change the value of a span or div using:
>> onClick= document.getElementById("searchkey").value = "type min 3
>> letters";
>>
>> but that does not work for an input type=text element.
>>
>> What is the proper way to do that?
>
> Did you mean that the other way around? If so you might want the
> 'textContent' property.

And make sure correct quoting is used. Use HTML entity and escape sequence
if necessary.

Cause, the provided sample code will never work, regardless of what HTML
tag/element it is on.

Re: changing the value of a text box with .js

<ipmi8nF3c0vU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17256&group=comp.lang.javascript#17256

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: usenet@arnowelzel.de (Arno Welzel)
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>
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>
 by: Arno Welzel - Mon, 6 Sep 2021 13:09 UTC

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

Re: changing the value of a text box with .js

<5497567.DvuYhMxLoT@PointedEars.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17268&group=comp.lang.javascript#17268

  copy link   Newsgroups: comp.lang.javascript
Path: i2pn2.org!i2pn.org!aioe.org!news.mb-net.net!open-news-network.org!.POSTED.178.197.205.73!not-for-mail
From: PointedEars@web.de (Thomas 'PointedEars' Lahn)
Newsgroups: comp.lang.javascript
Subject: Re: changing the value of a text box with .js
Date: Fri, 17 Sep 2021 00:46:48 +0200
Organization: PointedEars Software (PES)
Lines: 35
Message-ID: <5497567.DvuYhMxLoT@PointedEars.de>
References: <sh31k5$167f$1@gioia.aioe.org> <slrnsjai2s.78u.jon+usenet@raven.unequivocal.eu> <tx928w8dphta$.1jplgn5qs6ioi.dlg@40tude.net>
Reply-To: Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8Bit
Injection-Info: gwaiyur.mb-net.net; posting-host="178.197.205.73";
logging-data="2608023"; mail-complaints-to="abuse@open-news-network.org"
User-Agent: KNode/4.14.10
Cancel-Lock: sha1:aoF8toqWaDicLuLyyn10MgCd/yQ=
X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf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DuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
 by: Thomas 'Pointed - Thu, 16 Sep 2021 22:46 UTC

JJ wrote:

> On Sun, 5 Sep 2021 22:44:44 -0000 (UTC), Jon Ribbens wrote:
>> On 2021-09-05, bill <william@TechServSys.com> wrote:
>>> 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” elements do not have a built-in “value” property.

>>> but that does not work for an input type=text element.

*That* should work, though, as the corresponding object *does* have a built-
in value property.

>>> What is the proper way to do that?
>>
>> Did you mean that the other way around? If so you might want the
>> 'textContent' property.
>
> And make sure correct quoting is used. Use HTML entity and escape sequence
> if necessary.
>
> Cause, the provided sample code will never work, regardless of what HTML
> tag/element it is on.

By contrast to the “innerHTML” property, the “textContent” property does not
require any escaping beyond the one required for a syntactically correct
ECMAScript program; indeed, if you HTML-escape the value assigned to it, the
escape sequences will be displayed verbatim.

--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.


devel / comp.lang.javascript / changing the value of a text box with .js

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor