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 9107943
In Process

The Archive Base Latest Questions

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

Trying to bind an array with a table, if I have this: <table data-bind=foreach:

  • 0

Trying to bind an array with a table, if I have this:

<table data-bind="foreach: Applicants, visible: Applicants().length > 0">
        <tr>
        <td>
        <p data-bind="text:FirstName() + ' ' + LastName()" />
        <img data-bind="attr:{src: URL}" width="100px" height="100px" alt="test" /></td>
        </tr>
</table>

the img tag won’t be generated, just omit from the display.

Have to have another <td> wrap <img> to display it. Why?


Ok, @Stokedout is right, after trying with </p> instead of using closed tag <p .... />, it works.
So if the tag could have value but is closed without any value then knockout won’t work for the rest of tags..

Example:

Will work: — Both first name and last name will display.

      <p data-bind="text: FirstName"></p>
      <p data-bind="text: LastName"></p>

Will NOT work: — ONLY first name will display

      <p data-bind="text: FirstName"/>
      <p data-bind="text: LastName"/>

I AM NOT SURE WHY!

  • 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-17T02:41:27+00:00Added an answer on June 17, 2026 at 2:41 am

    When you write:

    <p data-bind="text:FirstName() + ' ' + LastName()" />
    <img data-bind="attr:{src: URL}" width="100px" height="100px" alt="test" />
    

    Without a closing tag, the img will be treated as the content the paragraph. For self-closed P element, the browser can infer that the paragraph has ended by the start of the next paragraph.

    When you bind using this:

    data-bind="text:FirstName() + ' ' + LastName()" 
    

    KO will try to set text to your P element and it clear the previous content.

    Solution is very simple, just add a closing tag:

    <p data-bind="text:FirstName() + ' ' + LastName()"></p>
    <img data-bind="attr:{src: URL}" width="100px" height="100px" alt="test" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to add a data on table view via Array Controller thats bind
I have a ListActivity that I'm trying to bind to an array of business
I'm trying to bind a list of data to a data grid, but can't
Hi I'm trying to bind data to a kendochart, but no bars are appearing
I am trying to bind the Text of a TextBox named 'txtImage' to an
I'm trying to have a Table View displaying the content of a generic SQLite
I'm trying to bind a php variable to pl/sql array. The pl/sql procedure works
I am trying to bind array of structs to the ToolStripCombobox but with no
I am trying to bind a 2D array of buttons arranged in stackpanels to
I am trying to bind a dynamic array of elements to a view model

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.