nguyen hung

nguyen hung

  • 0
  • 248
  • 0

why \r\n can not break new line with hidden field?

Mar 5 2021 10:52 AM
I have this script: 
 
 
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<p>Click the button to display an alert box.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var aaaa = $("#custId").val();
confirm(aaaa.toString());
}
</script>
<input type="hidden" id="custId" name="custId" value="Test\r\n Demo">
</body>
</html>
 
 
 
why \r\n can not create new line?? 
 
Thanks!!!!!! 

Answers (3)