如何在追加功能中显示特定内容?

时间:2017-07-21 20:12:48

标签: javascript html

首先,我想说明我在jquery mobile工作。

基本上我有以下代码:

if($("#favourite1").is(":checked")){
    $("#favouritecontent").append("");
}

现在在追加功能中我想在下面显示以下代码或者其他内容:

<ul data-role="listview">
    <li>
        <a href="#">
        <img src="chrome.png">
        <h2>Google Chrome</h2>
        <p>Google Chrome is a free, open-source web browser. Released in 2008.</p>
        </a>
    </li>
</ul>

我会怎么做?

感谢

1 个答案:

答案 0 :(得分:0)

const html = `
    <ul data-role="listview">
      <li>
        <a href="#">
        <img src="chrome.png">
        <h2>Google Chrome</h2>
        <p>Google Chrome is a free, open-source web browser. Released in 2008.</p>
        </a>
      </li>
    </ul>

`

if ($("#favourite1").is(":checked")){
   $("#favouritecontent").append(html);
}
相关问题