1

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?

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.