Javascript 使用Jquery Mobile时,我的列表按钮未显示

Javascript 使用Jquery Mobile时,我的列表按钮未显示,javascript,jquery,html,jquery-mobile,Javascript,Jquery,Html,Jquery Mobile,我一直在使用jQuery Mobile开发我的web应用程序。我最近写了一小段代码,它将获取一些文本并以列表的形式显示出来,但它显示为链接 这段代码应该是动态创建按钮的,但它是以链接的形式出现的: function myFunction() { $("#listview1").empty(); // This will get the data $.get("#",function(data){ $(data).find('UserProfile').e

我一直在使用jQuery Mobile开发我的web应用程序。我最近写了一小段代码,它将获取一些文本并以列表的形式显示出来,但它显示为链接

这段代码应该是动态创建按钮的,但它是以链接的形式出现的:

function myFunction()
{
    $("#listview1").empty();

    // This will get the data
    $.get("#",function(data){
        $(data).find('UserProfile').each(function(index){

        // This is the real part this part is supposed to create the button
        $("<li data-theme='a'>"+
            "<a href='#page6' data-transition='slide' onclick='myFunction2(this)'>" +
            $(this).find('LoginId').text() + " " +
            $(this).find('FirstName').text() + " " +
            $(this).find('EmailID').text() +
            "</a>" + "</li>").appendTo("#listview1");
        });
    });

    var count=0;
    $("#listview1").children().each(function(){
        $(this).attr('id','li'+count);
        $(this).addClass("libutton");
        ++count;
    });
}
函数myFunction()
{
$(“#listview1”).empty();
//这将获得数据
$.get(“#”),函数(数据){
$(数据)。查找('UserProfile')。每个(函数(索引){
//这是真实的部分这部分应该是用来创建按钮的
$(“”+
“+””。附加到(“列表视图1”);
});
});
var计数=0;
$(“#listview1”).children().each(function()){
$(this.attr('id','li'+计数);
$(this.addClass(“libutton”);
++计数;
});
}

主要的问题是,当我使用它在jQuery Mobile中动态显示按钮时,它是以链接而不是按钮的形式出现的。

当您向jQuery Mobile元素动态添加内容时,您必须调用它:

$("#listview1").listview('refresh');