JJ wrote:
On Sun, 5 Sep 2021 22:44:44 -0000 (UTC), Jon Ribbens wrote:
On 2021-09-05, bill <[email protected]> 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.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)