2013-08-26 20 views

回答

1

不知道你想要的那種代碼,這裏的任何方面,它是

$('#dataid').attr('type', 'input'); 

DEMO HERE

1

事情是這樣的:

$(document).ready(function() { 
    $('#buttonId').click(function() { 
    input = $('#inputId'); 
    if(input.attr('type') == 'text') { 
     input.attr('type', 'date'); 
    } else { 
     input.attr('type', 'text'); 
    } 
    }); 
}); 

http://jsfiddle.net/TuvXm/

1
$("button").click(function(){ 
    $("#foo").prop("type","checkbox"); //instead of checkbox, you may put any type 
}) 

的jsfiddle:http://jsfiddle.net/ZT6Xy/1/

0

試試這個

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

這裏是工作樣例fiddle

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";      
}); 

});

請參閱下面的截圖類型更改爲文本。

enter image description here

相關問題