Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9181959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:26:47+00:00 2026-06-17T18:26:47+00:00

Html: <p>Order</p> <div> <ul data-role=listview id=myorder></ul> </div> JS: itemName = [beer1, beer2, beer3, beer4];

  • 0

Html:

<p>Order</p>
<div>
<ul data-role="listview" id="myorder"></ul>
</div>

JS:

itemName = ["beer1", "beer2", "beer3", "beer4"];
itemQty = [0, 2, 0, 4];

for ( var i=0, len=itemName.length; i<len; ++i) { 
    if (itemQty[i] > 0) {
        var listItem = document.createElement("li");
        listItem.innerHTML = itemName[i] + "    Qty:" + itemQty[i];
        $('#myorder').append(listItem);
        $('#myorder').listview('refresh');
    }
}

I know its staring me right in the face but why is this only showing my first instance of Qty > 0?

http://jsfiddle.net/Sptx7/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:26:48+00:00Added an answer on June 17, 2026 at 6:26 pm

    You’re getting an error here:

    $('#myorder').listview('refresh');
    

    since listview is undefined, so the code terminates.


    Here’s your fiddle with that line commented out: http://jsfiddle.net/Sptx7/2/

    As you can see, it renders both list items.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have something like this: jsfiddle <div data-role=content> <ul data-role=listview data-split-icon=gear data-split-theme=d> <li><a href=index.html>
I have two div tags in single HTML with data-role as 'page'. First one
assume I have a such html order <div id=header>>Header(logo, navigation menus etc)will be here,
I have the following html code (in the given order) <div id=content>...</div> <div id=footer>...</div>
I'm trying to use XSL-stylesheets in order to transform some generated XML-data to HTML-output.
I use html's data- attribute on a list of menu links in order to
Here is html <div id=cart_table style=width:800px; position:absolute;> <h3>My Cart</h3> Please check your shipping data
The divs below appear in that order in the HTML I am parsing. //div[contains(@class,'top-container')]//font/text()
I got this code: function datatable_display(json) { var order = desc; var len =
I'm using the following tutorial http://developer.android.com/resources/tutorials/views/hello-mapview.html in order to create a map view and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.