Home Cooker Classes Others Rice CookerGX
Classes  >  element  >  ReplaceAdjacentText(string,string)
element class : ReplaceAdjacentText(string,string) method

Description

Replaces a text at the specified position.

Syntax

elementInstance.ReplaceAdjacentText(string where, string text)

Arguments

ClassNameDescription
stringwhereA string that indicates the position which to replace.
stringtextA replace text.

Return value

ClassDescription
stringA string that was replaced.

Sample code

//anyElement is any instance of element type.

string where = "afterBegin"

string text = "any text";

anyElement.ReplaceAdjacentText(where, text);

Notes

It's a wrapper of the MSHTML.IHTMLElement2.replaceAdjacentText(String,String).

The following values can specify as the first argument.

beforeBegin: The previous sibling of the invoker element.

afterBegin: The first child of the invoker element.

beforeEnd: The last child of the invoker element.

afterEnd: The next sibling of the invoker element.

If there is no text at specified position, argument text is inserted at specified position and returns empty string.

The text will automatically be HTML escaped.

Links for reference

Copyright © Rice All rights reserved.