Question

i have created a dynamic jquery split button listview on a clickable button whose structure is something like this:

var Book="Book Item"
     var data="hi";
            //Create the listview if not created
            if(!listCreated){
                $("#content").append("<ul id='list' data-role='listview' data-inset='true'></ul>");
                listCreated = true;
                $("#content").trigger("create");
            }
            $("#list").append("<li data-theme='d'>"+"<a id='list_content' data-rel='popup' data-position-to='window' data-transition='pop'>"+data+"</a>"+"<a id='list_content_checkout' data-rel='popup' data-position-to='window' data-transition='pop'></a>"+"</li>");
             $("#list").listview("refresh");
             
             
  $("#list_content").click(function(){
     alert();// 
});
  

in given below line data is a variable whose value i want on list view click.

$("#list").append("<li data-theme='d'>"+"<a id='list_content' data-rel='popup' data-position-to='window' data-transition='pop'>"+data+"</a>"+"<a id='list_content_checkout' data-rel='popup' data-position-to='window' data-transition='pop'></a>"+"</li>");

enter image description here

when we click on ANKUR listview data, in alert ankur should come.

sorry for my english. thanks

Était-ce utile?

La solution

$(document).ready(function () {
    Getdata();
});

function Getdata() {

var htmlcontent = "";
var strord_key = "1234";
htmlcontent += "<li data-role='list-divider'><br>";
htmlcontent += "<a href='javascript:void(0);' onclick= goToNext('" + strord_key  + "')     >Order Ticket:  " + strord_key + "</a> </li>";
$("#result-listview").empty();
$('#result-listview').append(htmlcontent);

}
  function goToNext(value) {
    alert(value);
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top