setInnerHTML arguments?

84 views
Skip to first unread message

Don Morrison

unread,
May 23, 2023, 4:42:03 PM5/23/23
to nodeGame

The documentation describes setInnerHTML as follows:

W.setInnerHTML(search, replace, mod): Sets the content of element/s with matching id or class name or both.

What do those arguments mean? Is one of them the id, another the class name, and the third the text to stick in there? Or something else? They don’t really seem to match the description.



Don Morrison d...@ringing.org
“The Internet is truly an amazing thing — it has unlocked human
creativity to allow us to devise more bad ideas than previous
generations ever imagined were possible.”
— Nathaniel Borenstein, from a message to Dave Farber’s
Interesting People mailing list

shakty

unread,
May 24, 2023, 6:10:51 AM5/24/23
to nodeGame
Hi Don,

You are right the documentation is not so clear there. Here is the inline doc:


Replaces the innerHTML of the element with matching id or class name
     *
     * @param {string|number} search Element id or className
     * @param {string|number} replace The new value of the property innerHTML
     * @param {string} mod Optional. A modifier defining how to use the
     *    search parameter. Values:
     *
     *    - 'id': replaces at most one element with the same id (default)
     *    - 'className': replaces all elements with same class name
     *    - 'g': replaces globally, both by id and className

Let me know if you have other questions.

Cheers,
Stefano

Reply all
Reply to author
Forward
0 new messages