Piotr Dobrogost
Piotr Dobrogost

Reputation: 42465

QtWebKit, QWebElement::setPlainText() problem

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?

Upvotes: 1

Views: 1396

Answers (1)

Piotr Dobrogost
Piotr Dobrogost

Reputation: 42465

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 :)

Upvotes: 2

Related Questions