Date Input in safari

Posted by Fresheyeball on Stack Overflow See other posts from Stack Overflow or by Fresheyeball
Published on 2012-06-17T21:12:32Z Indexed on 2012/06/17 21:16 UTC
Read the original article Hit count: 231

Filed under:
|
|
|

So I am using the HTML5 date input type, primary to trigger the 'wheels' in iOS. Everything is working fine in ie7-9 Chrome and FF. But Safari for OSX is very upset. It sees the need to add little 'up and down' buttons to the right hand side and generally mess up my visual stylings.

My attempt to fix this, is to change the date inputs back to text inputs for desktop browsers, and leave it as date inputs for mobile:

 unless device.is # 'device' is a lib I use to detect mobile browsers
    dateFields = $ 'input[type="date"]'
    dateFields.attr 'type', 'text' #this fails
    dateFields.datepicker()
    dateFields.on 'keyup', (e) ->
        e.preventDefault()
        $(@).val ''

Beyond altering the input type with js, I am at a loss for how to fix this little bugger. Have you had to deal with this problem?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html5