Use jQuery's .val(…) in the value binder's routine function if window.jQuery is …
…present. [Closes #133]
Showing
1 changed file
with
6 additions
and
0 deletions
... | @@ -313,6 +313,12 @@ Rivets.binders = | ... | @@ -313,6 +313,12 @@ Rivets.binders = |
313 | unbind: (el) -> | 313 | unbind: (el) -> |
314 | unbindEvent el, 'change', @currentListener | 314 | unbindEvent el, 'change', @currentListener |
315 | routine: (el, value) -> | 315 | routine: (el, value) -> |
316 | if window.jQuery? | ||
317 | el = jQuery el | ||
318 | |||
319 | if value?.toString() isnt el.val()?.toString() | ||
320 | el.val if value? then value else '' | ||
321 | else | ||
316 | if el.type is 'select-multiple' | 322 | if el.type is 'select-multiple' |
317 | o.selected = o.value in value for o in el if value? | 323 | o.selected = o.value in value for o in el if value? |
318 | else if value?.toString() isnt el.value?.toString() | 324 | else if value?.toString() isnt el.value?.toString() | ... | ... |
-
Please register or sign in to post a comment