jquery Mobile 架構下添加新的Dom元素

來源:互聯網
上載者:User

最近在做移動端web開發 要在一個Ul 節點下添加一個li節點 ul代碼如下 <ul   id="AlarmList"  data-role="listview" data-inset="true" data-theme="c" >     <li>      <a href="" rel="external" style=" font-style:normal"><img src="images/GPS監測站.png"  alt="GPS表面位移" class="ui-li-icon" /> <h3>&nbsp;&nbsp;GPS監測點1</h3>                        <p><font color=red>&nbsp;&nbsp;&nbsp;X 位移1m超出正常範圍</font></p>                        <p><font color=red>&nbsp;&nbsp;&nbsp;安全層級:三級警示  請檢查!</font></p>       </a>     </li>     <li>      <a href="" rel="external" style=" font-style:normal"><img src="images/滲流量.png" alt="滲流量" class="ui-li-icon" />                        <h3>&nbsp;&nbsp;滲流量1</h3>                        <p>&nbsp;&nbsp;&nbsp;<font color=red>流量:23 超出正常範圍</font></p>                        <p>&nbsp;&nbsp;&nbsp;<font color=red>安全層級:三級警示  請檢查!</font></p>       </a>     </li>     <li>      <a href="" rel="external" style=" font-style:normal"><img src="images/浸潤線.png" class="ui-li-icon" /> <h3>&nbsp;&nbsp;浸潤線2</h3>                        <p><font color=red>&nbsp;&nbsp;&nbsp;降深值3 超出正常範圍</font></p>                        <p><font color=red>&nbsp;&nbsp;&nbsp;安全層級:危險 請檢查!</font></p>       </a>     </li>              </ul> 我添加一個li節點 [html]  var str = "<li id=\"li1\"><a href=\"\" rel=\"external\" style=\" font-style:normal\"><img src=\"images/浸潤線.png\" /><h3>  GPS監測點1</h3><p><font color=red>   X 位移1m超出正常範圍</font></p><p><font color=red>   安全層級:三級警示  請檢查!</font></p></a></li>";              $("#AlarmList").append(str);              $("#li1 img").addClass("ui-li-icon");  但這樣圖片出不來啦,真的很糾結 效果如下  太難看啦 加上一行代碼 [html] $("#AlarmList").listview('refresh');  效果立馬就出來啦

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.