I am just starting woth Knockout and am following the tutorials. While it works like a charm on IE it does not appear to on any other browser and I cannot see what I am doing wrong.
Here is the page markup
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />
<link href="/Content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table>
<tbody>
<tr>
<td><label for="Text">Text</label></td>
<td>
<input type="text" id="Text" name="Text" data-bind="text:Text"/>
开发者_运维知识库 </td>
</tr>
</tbody>
</table>
</body>
</html>
<script src="/Scripts/jquery-1.5.min.js" type="text/javascript"></script>
<script src="/Scripts/knockout-1.2.0.js" type="text/javascript"></script>
<script src="/Scripts/knockout.mapping.js" type="text/javascript" ></script>
<script type="text/javascript">
var model = {"Text":"Test Text"};
ko.applyBindings(model);
</script>
Many thanks for any help
UPDATE
Discovered my error and it was quite simple. Rather than delete the question I will leave it up in case anyone else comes across this. The problem is IE again ! and the fact that it appear to work in IE makes it seem as though the others are at fault, when, in fact, IE is being a bit lax about interpreting the binding expression.
the line
<input type="text" id="Details_CompanyName" name="Details.CompanyName" data-bind="text:Details.CompanyName"/>
... sould be
<input type="text" id="Details_CompanyName" name="Details.CompanyName" data-bind="value:Details.CompanyName"/>
This looks to possibly be a bug?
Look here and here for jsFiddle examples of a simple change from to
精彩评论