Question

I have this code for putting text into a textbox in a website:

Website code:

<textarea class="chat_input">

    Enter text for chat here

</textarea>

Program Code:

message = txtMessage.Text;
foreach(Node txt in wb.Document.GetElementsByTagName("textarea"))
{
    if(((Element)txt).GetAttribute("Class") == "chat_input")
    {
        ((Element)txt).TextContent = message;
    }
}

But the problem is, it only puts the text in when the textbox is focused. Is there any way I can focus the textbox so that I don't have to do it manually?

Was it helpful?

Solution

How about Element.focus method?

I don't know if your webkit binding is exposing that method, but its standard DOM method. http://www.w3schools.com/jsref/met_html_focus.asp

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top