Knockout text databind erasing part of my Markup

I'm facing a small problem regarding Knockout JS databind on a span. I want to bind a number alongside a percentage symbol. My original HTML markup is this one:


Then, I'd try to make the number dynamic with the following expression (I'm forfeiting the JS as it works corrctly and I don't think it's necessary for my case):

<span data-bind="text: cartTotalPrice" /><span>%</span>

Misteriously, the that contains the % symbol disappears, only displaying the binded number. But then if I do the following, the number and the symbol are correctly displayed:

<span data-bind="text: cartTotalPrice() + '%'" />

Why does this happen? Is it normal?



I believe the problem is that you are not closing your span tag. Use an explicit closing </span>.

<span data-bind="text: cartTotalPrice"></span><span>%</span>

Need Your Help

WPF controls do not align

c# .net wpf

NOTE: This is one of the first time I'm using WPF.

Laravel - Pass more than one variable to view

php laravel laravel-3

I have this site and one of its pages creates a simple list of people from the database. I need to add one specific person to a variable I can access.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.