I am working on an app which supports 2 languages(English and Arabic) using JQuery mobile. Hence I need to to dynamically toggle(adding and removing) between jquery.mobile-1.4.2.min.js and rtl.jquery.mobile-1.4.0.js. I have tried
function loadjsfile(filename){
var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", filename)
if (typeof fileref!="undefined")
document.getElementsByTagName("head")[0].appendChild(fileref)
}
And similarly removing the js file. The app is navigating to the first screen(index.html). My assumption is that when either of the jquery.mobile-js is loaded, it initialises some values and when the js file is removed. Those variable values are lost hence navigating to first page.
Please help if any one has faced and overcome this issue. Also I am open for any suggestions. Thanks in advance.