我想向文本区域添加一个字符串,该文本区域的值可能大于2行。它可能是ASCII艺术,但我的主要问题是如何将ASCII艺术发布到文本区域? 我正在使用jQuery和以下代码:如果我使用特定按钮即包含一个类,那么代码将是什么。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("input:text").val(" (██)
__________(█)_______________██████
_________(███)___________ █████████
________(█████)________████████████
______ (███████)______ (░░░░░░░░░░░)
_____(█████████)_____(░░░░█░░█░░░░)
____(██░░░░░░░██)___ (░░(░░░●░░░)░░░)
_____▒░░█░░█░░▒____ (░░░(░░◡░░)░░░░)
____▒░░░░░░░░░░▒___ (░░░░░░░░░░░░░)
____▒░░█░░░█░░░▒___██(░░░░░░░░░)██
____▒░░░███░░░░▒___███(░░░░░░)████
_____▒░░░░░░░░▒___████████████████
_____██░░░░░░██___████████████████
____▒▒███████▒▒___███ █████████ ███
___▒░░░█████░░░▒__███ █████████ ███
_▒░▒░░░███░░░▒░▒__███ █████████ ███
_▒░░▒░░███░░▒░░▒_ ███ █████████ ███
_▒░░░▒░███░▒░░░▒_ (░░) █████████_(░░)
__▒░░▒░███░▒░░▒_______█████████__(██)
_▒▒▒▒░░███░░▒▒▒▒_____█████████__/▓▓▓\
_▒░░░░░░░░░░░░░▒____ ████__████▓▓▓▓▓▓)
▒░░░░░░░░░░░░░░░▒___████__████▓▓▓▓▓▓▓)
▒░░░░░░░░░░░░░░░▒___████__████▓▓▓▓▓▓▓)
▒░░░░░░░░░░░░░░░▒__(░░░░)_(░░░░)▓▓▓▓▓▓▓)
▒░░░░░░░░░░░░░░░▒___████__████▓▓▓▓▓▓▓▓)
_▒░░░░░░░░░░░░░▒____ ████__████▓▓▓▓▓▓▓)
__▒▒▒▒▒▒▒▒▒▒▒▒▒______████__████▓▓▓▓▓▓)");
});
});
</script>
<!DOCTYPE html>
<html>
<head></head>
<body>
<p>Name: <input type="text" name="user"></p>
<button>Set the value of the input field</button>
</body>
</html>