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

  • Home
  • SEARCH
  • 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 8468205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:51:59+00:00 2026-06-10T15:51:59+00:00

I am trying to write a somewhat simple todo application using knockout.js and jquery

  • 0

I am trying to write a somewhat simple todo application using knockout.js and jquery mobile. The code works very well when I am just using knockout (replacing text in the main page on the fly as I add items). However, jquery mobile won’t render properly after adding items to a ko.observableArray.

I can see the code render properly for a split second, then the page refreshes and it is not showing ANY of the list items anymore.

The HTML:

<div data-role="page">
    <div data-role="header">
        <h1>Lists</h1>
    </div>

    <div data-role="content">
        <ul data-bind="foreach: lists" data-role="listview" data-inset="true">
            <li data-bind="text: name"></li>
        </ul>

        <form data-bind="submit: addList">
            <input data-bind="value: newListName" placeholder="new list name" />
            <button type="submit">Add New List</button>
        </form>
    </div>

    <div data-role="footer" data-position="fixed">
        <h1>Footer</h1>
    </div>
</div>

The Javascript:

function List(data) {
    var self = this;
    self.name = ko.observable(data.name);
    self.tasks = ko.observableArray([]);
}

function TaskListViewModel() {
    var self = this;

    self.currentList = ko.observable(new List({ name: "Inbox" }));
    self.newListName = ko.observable('');
    self.lists = ko.observableArray([self.currentList()]);

    self.addList = function() {
        self.currentList(new List({ name: this.newListName() }));
        self.lists.push(self.currentList());
        self.newListName('');
    };
}

More specifically, I can see a list item with “Inbox”, with a text field below and then a button below that. When I type in another list item into the field and click “Add”, I can momentarily see everything correctly rendered. Then it refreshes and I see no list items.

Any help appreciated.

  • 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-10T15:52:01+00:00Added an answer on June 10, 2026 at 3:52 pm

    It sounds like the form is being submitted and the page reloaded. Try the workaround here: jquery mobile and knockout form submit binding

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

Sidebar

Related Questions

So, I'm trying to make a simple call using jQuery .getJSON to my local
I'm trying to write a simple app that should mute my mobile phone for
I am trying to write an application using Java that will allow me to
I m trying write code that after reset set up rrpmax as 3000. It
Trying to write a code at the moment that basically tests to see if
I'm currently trying to write a multiple-file Python (2.6.5) game using PyGame. The problem
I am trying to write a PHP-MySQL database processor that is somewhat intelligent. When
I'm somewhat new to Unity and dependency injection. I'm trying to write a unit
I'm trying to write a piece of code which receives a string, uses the
I'm trying to build a simple website with login functionality very similar to the

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.