Use jQuery's .val() in getInputValue if window.jQuery is present. [#133]
Showing
1 changed file
with
8 additions
and
1 deletions
... | @@ -251,8 +251,15 @@ unbindEvent = (el, event, fn) -> | ... | @@ -251,8 +251,15 @@ unbindEvent = (el, event, fn) -> |
251 | event = 'on' + event | 251 | event = 'on' + event |
252 | el.detachEvent event, fn | 252 | el.detachEvent event, fn |
253 | 253 | ||
254 | # Returns the current input value for the specified element. | 254 | # Cross-browser input value getter. |
255 | getInputValue = (el) -> | 255 | getInputValue = (el) -> |
256 | if window.jQuery? | ||
257 | el = jQuery el | ||
258 | |||
259 | switch el[0].type | ||
260 | when 'checkbox' then el.is ':checked' | ||
261 | else el.val() | ||
262 | else | ||
256 | switch el.type | 263 | switch el.type |
257 | when 'checkbox' then el.checked | 264 | when 'checkbox' then el.checked |
258 | when 'select-multiple' then o.value for o in el when o.selected | 265 | when 'select-multiple' then o.value for o in el when o.selected | ... | ... |
-
Please register or sign in to post a comment