Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. jquery/jquerymobile - image inside collapsible>listview

jquery/jquerymobile - image inside collapsible>listview

Scheduled Pinned Locked Moved JavaScript
csharpjavascripthtmlmobiledatabase
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Prasoon Chaudhary
    wrote on last edited by
    #1

    I am trying to create a dynamic collapsible-set which would contain text and image. Texts are appearing fine but as soon as I try to write code (see commented line) for image, browser doesn't display it correctly. It takes 2-3 clicks to open the collapsible, and it gets stuck most of the time. Here is my code:

    $("#dvAccordion").empty();
    var outdiv = $('

    ');
    $(strXML).find('Category').each(function(){
    var colldiv = $('

    ');
    colldiv.append('

    ' + $(this).find('Category_Name').text() + '

    ');
    var uldiv = $('

    ');
    colldiv.append(uldiv);
    //
    $(this).find('Menu_Item').each(function(){
    var sItemName = $(this).find('item_name').text() ;
    //var sImageUrl = $(this).find('item_image').text() ;
    var sImageUrl = "images/food1.jpg" ;
    uldiv.append('* ' + sItemName + '
    ');
    //uldiv.append('
    * ![](' + sImageUrl + ')' + sItemName + '
    ');
    });
    //
    outdiv.append(colldiv);
    outdiv.appendTo('#dvAccordion');
    });
    //$('#dvAccordion [data-role=collapsible-set]').collapsibleset();
    //$('#dvAccordion').collapsibleset('');
    //$('#dvAccordion').collapsibleset('refresh');
    $('#dvAccordion').trigger('create');

    Where am I wrong? If I try to generate the collapsible with listview and images static way in html - everything works fine. jsFiddle - http://jsfiddle.net/yesprasoon/68v8p/ Surprisingly, images are appearing properly in fiddle. But it doesn't appear in my local file/ localhost address/ phonegap application. :-(

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups