如果大于某个值,我正在尝试使用敲除来隐藏文本。出于某种原因,我无法让它工作。当我单击测试按钮时,第二个文本字段应显示..
<body class="calc" onLoad="createnav()">
<input type="button" value="test" />
<p data-bind="text: 'This shows', if: 6 > 4" ></p>
<br>
<p data-bind="text: 'This does Not', if: 6 > qty"></p>
这是脚本:
function AppViewModel() {
this.qty = ko.observable("1"); }
// Activates knockout.js
var app = new AppViewModel(); ko.applyBindings(app);
//When I click button I want the name to change
$('input[type=button]').click( function() {
var sum = '5';
app.qty(sum);
});