Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
133
rated 0 times [  135] [ 2]  / answers: 1 / hits: 54779  / 12 Years ago, wed, august 8, 2012, 12:00:00

I am trying to change type of input, specifically after click into input I need to change type=text to type=date.



<input type=text placeholder=DOB id=dob name=dob />
<script>
$(#dob).click(function () {
$(this).attr('type', 'date');

});
</script>


I want to accomplish this for a iphone App. This is not working in iphone 4. How can do this?


More From » jquery

 Answers
132

Use this code :



<input type=text placeholder=DOB id=dob name=dob  />
<script>
$(#dob).click(function(){
$(this).prop('type', 'date');

});
</script>


Here is the fiddle : http://jsfiddle.net/HNKkW/


[#83770] Tuesday, August 7, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
frederickmohamedw

Total Points: 21
Total Questions: 123
Total Answers: 105

Location: The Bahamas
Member since Tue, Apr 27, 2021
3 Years ago
frederickmohamedw questions
Wed, Sep 23, 20, 00:00, 4 Years ago
Sat, Jul 18, 20, 00:00, 4 Years ago
Sun, Apr 26, 20, 00:00, 4 Years ago
Sat, Jan 11, 20, 00:00, 4 Years ago
Fri, Dec 27, 19, 00:00, 4 Years ago
;