I need to get data bind keys and value observable using element.
Well i recommend you use this. You can handle it on javascript end using jquery unobtrusive plugin
.
http://joel.net/unobtrusive-data-binding-for-knockout-js
For this you can create an object
var binding = {
options: 'tickets',
optionsCaption: "'Choose...'",
optionsText: "'name'",
value: 'chosenTicket'
}
And use it like this
$('#tickets').dataBind(binding);
Instead of this
this way you will have the binding
object available to reuse and your code will be quite clean. Make sure you call it before applyBinding
.