My javascript does not seem to load at all when i am using android's webview but loads fine on a desktop browser
Here is my html and script under one html file:
<script>
function initialiseFields(){
var name = "John Smith";
var staffId = "9877878";
alert( 'initialiseFields' );
$("#list").append('<li><h3>Additional Information:</h3><div data-role="fieldcontain"><input type="text" name="claimTitle" id=/"textFieldJourneyFrom" value="" /></div></li>');
$('#list').listview('refresh');
}
</script>
<body onLoad="initialiseFields();">
<div data-role="content">
<ul class="ui-li" data-role="listview" id="list" data-inset="true" data-scroll="true">
</ul>
</body>
Basically trying to execute the initialiseFields that displays an alert and add some field into the listView.
The alert and the listView never gets invoked/updated.
Edit: Also, whatever list item I add via javascript, it doesnt apply the default jquery mobile css style either. Any reason why?
Another Edit:
Solution is provided by the person i have accepted the answer, however a word of warning. if you are using a datepicker and its assets. the soltuons provided doesnt work i.e it doesnt load your JS for some strange reason:
<link href="jQueryAssets/jquery.ui.core.min.css" rel="stylesheet" type="text/css">
<link href="jQueryAssets/jquery.ui.theme.min.css" rel="stylesheet" type="text/css">
<link href="jQueryAssets/jquery.ui.datepicker.min.css" rel="stylesheet" type="text/css">
<link href="jQueryAssets/jquery.ui.button.min.css" rel="stylesheet" type="text/css">.
Also, i tried the above snippet of code by simply setting the theme and it managed to apply the theme on the text and header and background but on the actual field it does not apply it to the input field
$("#list").append('<li data-theme="c"><h3>Additional Information:</h3><div data-role="fieldcontain" data-theme="c"><input type="text" name="information" id=/"textFieldInformation value="" data-theme="c"/></div></li>');
edit 2:
Code was tested and working ok except for the theme of the input fields, however, my JS does not work at all on an android device.