i have one knockout view model function which is not invoke when clicking the button. probably i am missing something. i am running the code from VS2010 IDE. i test the same code in jsfiddle and it is working there but when i try to run the same code from VS2010 IDE then it is not working. any help would be appreciated. thanks
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
#dash
{
max-height: 128px;
overflow: hidden;
}
#dash div
{
border: 1px solid #de2345;
padding: 4px;
margin: 2px;
line-height: 20px;
box-sizing: border-box;
}
#dash div:before
{
content: '--> ';
}
</style>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-3.3.0.js"/>
<script type="text/javascript">
function TableModel()
{
var self = this;
self.Counter = 1;
self.rows = ko.observableArray([]),
self.addRow = function () {
alert('pp');
self.rows.push(self.Counter + ' ' + new Date());
self.Counter++;
setTimeout(function () {
self.rows.shift();
self.Counter--;
}, 3000 + self.rows().length * 1000);
return false;
}
}
ko.applyBindings(new TableModel());
</script>
</head>
<body>
<form id="form1" runat="server">
<button id="button" data-bind="click: addRow" type="button">click</button>
<div id="dash" data-bind="foreach: rows">
<div data-bind="text:$data">
</div>
</div>
</form>
</body>
</html>