1
for(var i=0; i< vendors.length;i++)
    {
     var $ul = $("<ul>").attr("data-role", "listview")
                .attr("data-divider-theme","a")
                .attr("data-inset","true")
                .appendTo("#vendorLists");
         $("<li>").attr("data-role", "list-divider")
                .attr("role","heading")
                .text(vendors[i])
                .appendTo($ul);
       for(var j=0; j<coupons[i].length; j++)
        {
            var x = coupons[i][j].split(":");           
            var $li = $("<li>").attr("data-theme", "a")     
                       .appendTo($ul);
            $("<a>").text(x[0] + ":" + x[1])
                       .appendTo($li);
            }
    }

I am using this code to create a list dynamically by fetching from a array. vendorList is a div tag

The Jquery isnt coming on these..only the text is being displayed Plz help

user1039985
  • 117
  • 8

2 Answers2

0

You mention vendorList is a div tag. However, you use appendTo("#vendorLists") in your definition of $ul. Unless you meant vendorLists is a div tag, then you want to use appendTo("#vendorList") instead.

Alex Williams
  • 355
  • 1
  • 4
0

Each time you add a dynamic content to the jQuery Mobile page you need to trigger a specific function meant to enhance page markup.

In your case it is this function:

$('[data-role="listview"]').trigger('refresh');

If you want to read more about that (with live jsFiddle examples) take a look at my other ARTICLE about this topic. Or it can be found HERE.

Community
  • 1
  • 1
Gajotres
  • 57,309
  • 16
  • 102
  • 130