Jquery Mobile未在page init事件中加载ListView元素上的脚本

Jquery Mobile未在page init事件中加载ListView元素上的脚本,jquery,jquery-mobile,Jquery,Jquery Mobile,脚本在html文件加载中加载一次,因此,当我使用event on pageinit或pagecreate并在event listview元素中写入json获取的文本数据时,应用程序在不使用任何脚本或jquery mobile样式的情况下编写html代码 <div data-role="page" id="hteacher" > <div data-role="header" data-position="fixed"> <h1>Welcome teache

脚本在html文件加载中加载一次,因此,当我使用event on pageinit或pagecreate并在event listview元素中写入json获取的文本数据时,应用程序在不使用任何脚本或jquery mobile样式的情况下编写html代码

<div data-role="page" id="hteacher" >  
<div data-role="header" data-position="fixed">
<h1>Welcome teacher 1</h1>
 <div data-role="navbar">
  <ul>

<div data-role="page" id="hteacher" >  
<div data-role="header" data-position="fixed">
<h1>Welcome teacher 1</h1>
 <div data-role="navbar">
  <ul>
    <li><a href="#hteacher" data-icon="home">Home</a></li>
    <li><a href="#t_addclass" data-icon="plus" data-rel="dialog">ADD Class</a></li>
    <li><a href="#msg_page" data-icon="star" data-rel="dialog">MSG</a></li>
  </ul>
  </div>
  </div>

 <div data-role="content">
 <p></p>
 <h2>list of classes </h2>
 <ul data-role="listview" id="classes_list" data-autodividers="true" data-inset="true"        data-filter="true">
 <script>
$( document ).delegate("#hteacher", "pagecreate", function() {
   var  html =  ' <li><a href="#"><img src="student1.jpg">BESHOY</a></li>';
   html +=  ' <li><a href="#"><img src="student2.jpg">MARY</a></li>';
  $("#classes_list").append (html );
          });

   </script>
   </ul>
  </div>

   <div data-role="footer" data-position="fixed">
   <h1>Welcome To .....</h1>
  </div>

  </div>    `

欢迎老师1
    欢迎老师1

    课程表
      $(document).delegate(“#hteacher”,“pagecreate”,function()){ var html='
    • '; html+='
    • '; $(“#类别列表”).append(html); });
    欢迎来到。。。。。 `
试试这个

在html中:

<div data-role="page" id="indexpage">
<div data-role="header" data-position="fixed">

<h1>Welcome teacher 1</h1>

    <div data-role="navbar">
        <ul>
            <li><a href="#hteacher" data-icon="home">Home</a>
            </li>
            <li><a href="#t_addclass" data-icon="plus" data-rel="dialog">ADD Class</a>
            </li>
            <li><a href="#msg_page" data-icon="star" data-rel="dialog">MSG</a>
            </li>
        </ul>
    </div>
</div>
<div data-role="content">
    <p></p>
     <h2>list of classes </h2>

    <ul data-role="listview" id="classes_list" data-autodividers="true" data-inset="true" data-filter="true"></ul>
</div>
<div data-role="footer" data-position="fixed">
     <h1>Welcome To .....</h1>

</div>
</div>`

欢迎老师1

课程表
    欢迎来到。。。。。 `
    剧本是:

    $(document).on("pagecreate", "#indexpage", function () {
    var  text =  '<li><a href="#">BESHOY</a></li>';
    text +=  ' <li><a href="#">MARY</a></li>';
    $("#classes_list").append (text );
    
    });
    
    $(文档)。在(“页面创建”、“索引扩展”上,函数(){
    变量文本=“
  • ”; text+='
  • '; $(“#类别列表”)。追加(文本); });
    请参阅此小提琴以获取输出(“#类列表”)。追加(html)。列表视图(“刷新”);