I have a button which I want to bind to a method in the VM using knockout. I am using the following code
<button type="button" class="btn btn-primary" id="cmdCreateConnection"
data-bind="click: function(data, event) {
createConnection($('#connectuser').val(),
'param2', data, event)
}">Create connection
</button>
One of the parameters to the method are values entered into a textbox, hence the selector $('#connectuser').val()
.
However this does not work, any ideas?