JQuery: Get original input value

前端 未结 7 1946
面向向阳花
面向向阳花 2021-02-07 01:51

Is it possible to get the initial value of a form input field?

For example:

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-07 02:48

    You could try storing the value in data. For example:

    $('#one').data('val',$('#one').val());
    

    And then you could easily retrieve it later like this:

    console.log($('#one').data('val'));
    

提交回复
热议问题