Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.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
CSS不会应用于jQuery mobile中动态创建的元素_Jquery_Css_Jquery Mobile - Fatal编程技术网

CSS不会应用于jQuery mobile中动态创建的元素

CSS不会应用于jQuery mobile中动态创建的元素,jquery,css,jquery-mobile,Jquery,Css,Jquery Mobile,我想将动态生成的列表项添加到jQuery移动页面中的无序列表中 但是当我添加新的列表项时,现有的CSS并没有被应用。分类列表是我的ul 我尝试了一些不同的方法,包括: jQuery('#sortedList').append('<li><h3>SUCCESS</h3></li>') jQuery('#sortedList li').html('<h3>SUCCESS</h3>') jQuery('#sortedList

我想将动态生成的列表项添加到jQuery移动页面中的无序列表中

但是当我添加新的列表项时,现有的CSS并没有被应用。分类列表是我的ul

我尝试了一些不同的方法,包括:

jQuery('#sortedList').append('<li><h3>SUCCESS</h3></li>')

jQuery('#sortedList li').html('<h3>SUCCESS</h3>')

jQuery('#sortedList li').append('<h3>SUCCESS</h3>')

jQuery('#sortedList li').trigger('create');
jQuery('#sortedList li').append('<h3>SUCCESS</h3>')
jQuery(“#sortedList”).append(“
  • SUCCESS
  • ”) jQuery('#sortedList li').html('SUCCESS')) jQuery('#sortedList li').append('SUCCESS')) jQuery(“#sortedList li”).trigger('create'); jQuery('#sortedList li').append('SUCCESS'))

    没有任何效果,任何建议或建议都将不胜感激

    您应该将所有项目添加到列表中,然后刷新列表视图:

    $('#sortedList').append('<li><h3>Success</h3></li>').listview('refresh');
    
    $(“#sortedList”).append(“
  • Success
  • ”).listview('refresh');


    作为旁注:使用jQuery不必每次都拼出jQuery。
    $
    符号是jQuery对象的另一个名称,因此
    jQuery(“#mySelector”)
    相当于
    $(“#mySelector”)

    应该起作用:。@LinkinTED问题是关于jQuery mobile,而不是普通CSS。标题写得不好,但请仔细阅读问题的细节。这个问题可能重复回答了1000次。干杯,伙计,这非常有效!我知道$,但我必须使用jQuery选择器来实现这一点。干杯