0

In this example

<strong>Test:</strong>  <span data-bind="text: currentResult()? currentResult().test_name : '' " /><br/>
<strong>SampleId:</strong>  <span data-bind="text: currentResult()? currentResult().sample_id : '' " /><br/>

I see only one text - only the first:

Test: <test_name>

If I exchange the lines, I see only

SampleId:<my sample id>

It is not because of height limits. Inserting some breaks moves the first line lower.

Is there any syntactical error in the code or something else?

Firebug doesn't show any error.

I use Bootstrap. Both elements are inside a <div class="col-md-5">

Many thanks in advance!

Valentin H
  • 7,240
  • 12
  • 61
  • 111
  • Maybe the colon in the expression is breaking the parser. Try to replace that expression with a computed observable in your view model. – hasen Jun 17 '15 at 15:23
  • Depending on your doctype tag span as you write it may not be valid see http://stackoverflow.com/questions/2816833/can-a-span-be-closed-using-span - also I don't think that knockout templates should be mixed up with your plain html they may require stricter syntax. I suggest you write `` – Olga Jun 17 '15 at 15:34
  • @Olga: OK! this was the cause. It worked in many places in the code, but always the span was the only one element enclosed in div. Very dangerous, decent bug! If you write your comment as answer I'll accept it. Many thanks again! – Valentin H Jun 17 '15 at 15:48
  • `span` is not a self closing tag . consider modifying it and let us know – super cool Jun 17 '15 at 15:48

1 Answers1

1

From my comment:

Depending on your doctype tag span as you write it may not be valid see Can a span be closed using <span />? - also I don't think that knockout templates should be mixed up with your plain html they may require stricter syntax. I suggest you write <span data-bind=""></span>.

Community
  • 1
  • 1
Olga
  • 1,648
  • 1
  • 22
  • 31