Get default value of an input using jQuery

前端 未结 6 1044
梦谈多话
梦谈多话 2021-01-04 00:53
$(\".box_yazi2\").each(function () {
    var default_value = this.value;
    $(this).css(\'color\', \'#555\'); // this could be in the style sheet instead
    $(this         


        
6条回答
  •  误落风尘
    2021-01-04 01:30

    Just use the defaultValue property:

    var default_value = $(this).prop("defaultValue");
    

    Or:

    var default_value = this.defaultValue;
    

提交回复
热议问题