jQuery .prop(“disabled”, false) is not enabling an input

后端 未结 4 825
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-07 01:30

I\'m having a problem re-enabling an input after it has been disabled on the page load.

I\'m using two inputs to accept two dates, but I want it that the second input is

相关标签:
4条回答
  • 2021-02-07 01:47

    Prop is used just to get the value and set the value. Refer this http://api.jquery.com/prop/

    $("#date1-end").prop("disabled", false);
    
    0 讨论(0)
  • 2021-02-07 01:51

    Had the same problem some time ago:

    $("#date1-end").prop("disabled", null);
    

    @Gautam3164's answer is also good.

    0 讨论(0)
  • 2021-02-07 01:53

    Working example: http://jsfiddle.net/d9vzs/

    This is not how you enable disable jQUery Mobile input elements.

    It can be done with this functions:

    $( "input" ).textinput( "disable" );
    
    
    $( "input" ).textinput( "enable" );
    

    Official documentation: http://api.jquerymobile.com/textinput/#method-disable

    0 讨论(0)
  • 2021-02-07 01:54

    Try with removeAttr like

    $("#date1-end").removeAttr("disabled");
    

    You can also try with prop like

    $("#date1-end").prop("disabled",false);
    
    0 讨论(0)
提交回复
热议问题