Using Knockout.js to bind bootstrap daterange picker and parse span contents
Posted
by
jmkr
on Stack Overflow
See other posts from Stack Overflow
or by jmkr
Published on 2012-09-24T23:31:22Z
Indexed on
2012/09/25
3:37 UTC
Read the original article
Hit count: 572
I'm new to knockout and trying to get what should be a simple task up and running. I'm working on an MVC4 .NET app with the intention of binding a date range picker to make ajax requests for updating Highchart graph data. I'm using Dan Grossman's bootstrap-themed date picker and it's been great so far (https://github.com/dangrossman/bootstrap-daterangepicker).
The basic goal is to watch the span that this jQuery date ranger picker updates, and then use knockout to pass this value to another part of the app for the ajax request.
I've tried everything I can find online.. valueUpdate:change on the span to using some jQuery within knockout to get the same goal done, to using a subscribe function to watch the value of the span before and after the date picker is used. Apparently this uses the jQuery .change() event handler, which is only good on inputs, selects, and textareas.. not spans.
Here's the fiddle of what I have so far: http://jsfiddle.net/eyygK/9/
Appreciate any help and input.
© Stack Overflow or respective owner