-1

Actually am using the below code in JS and getting the exact output.

mWebView.loadUrl("javascript:{document.getElementsByName('emailaddress')[0].value = '"+username+"';document.getElementsByName('password')[0].value = '"+password+"'}");

I want it to be done using jquery.

Jeevanandhan
  • 1,073
  • 10
  • 18

1 Answers1

1

Equivalent of

document.getElementsByName('emailaddress')[0].value = '"+username+"';
document.getElementsByName('password')[0].value = '"+password+"'

in jQuery is

$('[name="emailaddress"]:first').attr('value',username);
$('[name="password"]:first').attr('value',password);

To load jQuery library itself you have 2 options, first directly load the jquery lib from assets folder which is the best else load it through URL from publicly hosted URLs in which case will not work in offline mode.

You could try loading a html in your local assets folder and use the jQuery library as source include in your page.

browser.loadUrl("file:///android_asset/index.html");

Related posts:

jQuery Mobile not working in WebView when loading from local assets

Android WebView doesn't load jQuery

Community
  • 1
  • 1
Liam
  • 2,837
  • 23
  • 36