My java Fx webview throws JS exception for following code. Can anyone explain me why?
WebView webview = new WebView();
WebEngine webengine=webview.getEngine();
newtab.setText("Start Page");
newtab.setContent(webview);
editTabset.getTabs().add(newtab);
webengine.load("file:///E:/myproj/src/novuseditor/resources/html/clike.html");/*works till here*/
webengine.executeScript("document.getElementById('code').value=\"Hi\"");
/*exception:netscape.javascript.JSException: TypeError: 'null' is not an object */
webengine.load()call is asynchronous. You need to wait until document is loaded before applying javascript. E.g.:There is an example from the WebEngine javadoc.