<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type="text" name="" id="">
<input type="button" value="发送" id="btn">
<script src="js/jquery-1.12.4.min.js"></script>
<script>
$btn = $("#btn");
$btn.click(function(){
//定义变量存储时间
var n = 5;
$(this).prop("disabled",true).val(n+"s后重新发送")
//定时器
var timer = setInterval(() => {
n--;
$(this).val(n+"s后重新发送");
if(n<=0){
clearInterval(timer);
$(this).val("重新发送").prop("disabled",false);
}
}, 1000);
})
</script>
</body>
</html>