Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to check if javascript element id exist?



  • if (ui->webView->page()->mainFrame()->evaluateJavaScript(QString("document.getElementById('ContentPlaceHolder1_ErrorTextLabel').value"))!=null)
            {
    }
    

    I want to make a function that does commands whenever the user makes an invalid log in. So I made a getElementById such that whenever the error text label exist, i can carry out other commands but qt is giving me the error ['null' was not declared in this scope]
    Is it a syntax or declaration error?
    Anyone can help me with this? Thanks!


Log in to reply