Question

From Qt online help:

void QWebElement::setPlainText ( const QString & text )

Replaces the existing content of this element with text. This is equivalent to setting the HTML innerText property.

My code:

QWebElement login = doc.findFirst("input[name=\"login\"]");
login.setPlainText("alibaba");
qDebug() << login.toPlainText();

And the output is "".
Why I don't see new value of login element?

Was it helpful?

Solution

The problem is the input html element doesn't have the closing tag so there's no sense in using methods that operate (set some content) in a space between the opening and the closing tag...
Besides, it's value attribute that should be set and not the content of the input element :)

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