Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquerymobile不';t使用.html()解释插入的代码_Javascript_Jquery_Html_Jquery Mobile_Click - Fatal编程技术网

Javascript jquerymobile不';t使用.html()解释插入的代码

Javascript jquerymobile不';t使用.html()解释插入的代码,javascript,jquery,html,jquery-mobile,click,Javascript,Jquery,Html,Jquery Mobile,Click,当我使用click()和html()更改页面中的内容时,jquery mobile不会更改插入代码的视图,在本例中是listview 我构建了一个简短的示例来说明我的意思: 当您使用Suchen按钮时,它会插入列表,但它看起来不像jquery mobile listview JS: function searchSeries(){ list = '<ul id="seriesResultList" data-role="listview" style="margin-top: 2

当我使用
click()
html()
更改页面中的内容时,jquery mobile不会更改插入代码的视图,在本例中是listview

我构建了一个简短的示例来说明我的意思:

当您使用
Suchen
按钮时,它会插入列表,但它看起来不像jquery mobile listview

JS:

function searchSeries(){
    list = '<ul id="seriesResultList" data-role="listview" style="margin-top: 2em;" data-inset="true"><li><a href="#"><img src="http://www.tvdb.info/gfx/v/v20703.gif"><h2>Vegas</h2><p>USA 2012–</p></a></li></ul>';
    $("#searchResult").html(list);
}

$(document).ready(function() {
    $("#submit").click(function(){
        searchSeries();
    });
});
函数searchSeries(){
list='
  • /ul>; $(“#搜索结果”).html(列表); } $(文档).ready(函数(){ $(“#提交”)。单击(函数(){ searchSeries(); }); });
HTML

<form class="ui-body ui-body-a" id="seriesNew" action="index.php?site=autoseriesNew" method="post" style="padding-bottom: 2em;">
    <label for="newSerie">Serie:</label>
    <input type="search" name="newSerie" id="newSerie" value="">
    <button class="ui-shadow ui-btn ui-corner-all" type="submit" id="submit">Suchen</button>
</form>
<div id="searchResult">
</div>

系列:
苏晨

您需要触发“创建”事件来创建动态HTML jQM ish

您可以尝试以下方法:

$("#searchResult").trigger('create')
或者如果它不起作用

$(".ui-page").trigger('create')

在包含此元素的页面上。

在此处工作正常。您使用的浏览器是什么?
e.preventDefault()停止表单
提交
(如果这是您想要的)-检查-