jQuery您能告诉我如何在单击按钮  时更改输入标签的类型(日期为文本) 。
实际上我想做一些任务然后我想再次更改类型(文本到日期。)
像这样的东西:
$(document).ready(function() {
  $('#buttonId').click(function() {
    input = $('#inputId');
    if(input.attr('type') == 'text') {
      input.attr('type', 'date');
    } else {
      input.attr('type', 'text');
    }
  });
});
    $("button").click(function(){
    $("#foo").prop("type","checkbox"); //instead of checkbox, you may put any type
})
jsfiddle:http: //jsfiddle.net/ZT6Xy/1/
这是工作样本小提琴
HTML:
<input type="date" id="inputID"/>
<br>
<br>
<button id="submit">Submit</button>
脚本:
$( document ).ready(function() {
$("#submit").click(function(){
  var a = document.getElementById("inputID");
  a.type="text";                      
});
});
请参阅下面的屏幕截图类型更改为文本。

尝试这个
$('button').on('click', function(){
if(input.prop('type') == 'text') {
    $('input[type=text]').prop('type','date');
 }
else {
    $('input[type=text]').prop('type','date');
 }
});