change type of input field with jQuery

后端 未结 29 2590
青春惊慌失措
青春惊慌失措 2020-11-22 05:13
$(document).ready(function() {
    // #login-box password field
    $(\'#password\').attr(\'type\', \'text\');
    $(\'#passwo         


        
29条回答
  •  独厮守ぢ
    2020-11-22 05:44

    I just did the following to change the type of an input:

    $('#ID_of_element')[0].type = 'text';
    

    and it works.

    I was needing to do this because I was using jQuery UI datepickers' in an ASP NET Core 3.1 project and they were not working properly on Chromium-based browsers (see: https://stackoverflow.com/a/61296225/7420301).

提交回复
热议问题