簡體   English   中英

通過javascript添加jQuery Mobile UI元素

[英]Add jQuery Mobile UI Elements via javascript

我正在使用jQuery Mobile。 目前,我正在使用javascript將自定義標頭動態添加到html文件。 我想通過使用javascript將jQuery移動標頭添加到DOM來添加它。 不能直接將其添加到.html代碼。

怎么辦呢?

不知道我明白這個問題。 您的意思是:

<script type="text/javascript">

document.addEventListener('yourevent',function(){
    script = document.createElement('script');
    script.src = 'path/to/your/jquery script src';
    script.type = "text/javascript";
    document.getElementsByTagName('head')[0].appendChild(script);
},false);

</script>

回答:

->在jquery移動js之前加載具有文檔就緒功能的js文件,以用於創建DOM元素。 ->只需在.html文件的標題中進行更改。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM