如何使用jQueryMobile在特定页面中加载js文件? [英] How can i load js files in specific pages using jQueryMobile?
问题描述
众所周知,jQueryMobile使用ajax加载页面,并且不在DOM中包含每个页面中的标题内容。
It's a known fact that jQueryMobile loads pages with ajax and is not including in DOM the header content in every pages.
我需要加载自定义js文件有些页面,我怎么能做到这一点?到目前为止,我已将.js文件放在正文中,但是代码中也存在一些问题,所以这不是一个好的解决方法。直到我能找到解决方案,我将使用rel =外部解决方法,但我真的需要找到我的问题的答案。
I need to load a custom js file in some pages, how can i achive this? Until now i have placed the .js files in the body, but there are some problems with the code there too so it's not a good workaround. Until i can find a solution i will use the rel="external" workaround, but i really need to find an answer to my question.
推荐答案
您可以使用一些javascript动态地将js文件添加到DOM。
You could use some javascript to dynamically add the js file to the DOM.
此处演示如下: http:/ /www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
这篇关于如何使用jQueryMobile在特定页面中加载js文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!