我想要在拉动textarea高度的时候,当他大于200,就return false,只能在100-200这个范围拉伸高度
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.test {
resize: vertical;
}
</style>
</head>
<body>
<div>
<textarea class="test"></textarea>
<button id="btn">btn</button>
</div>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script>
$("#btn").click(function() {
if ($(".test").hasClass("actived")) {
$('.test').css("resize", "vertical")
$(".test").removeClass("actived");
} else {
$('.test').css("resize", "none")
$(".test").addClass("actived");
}
console.log($(".test").height())
if ($(".test").height() > 200) {
console.log(aa);
return false;
}
})
</script>
</body>
</html>
哔哔one