There is a textarea, the user enters there, for example, <p> Привет </p> , clicks OK and through js this is all done and the page displays "Hello". I am just a “teapot” in this “Sanskrit”, help!
Closed due to the fact that the issue is too general for the participants Denis Bubnov , ermak0ff , Akina , Grundy , user194374 8 Feb '17 at 6:36 .
Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .
|
2 answers
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("#new").html($("#inp").val()); }); }); </script> </head> <body> <textarea id="inp"></textarea><br> <button>ОК</button><br> <div id="new"><p>Здесь будет новый текст</p></div> </body> </html> |
<textarea name="name" id="" cols="30" rows="10"></textarea> <input type="button" id="btn" value="append"/> <script> $('#btn').on('click', function(){ $('body').append($('textarea[name=\'name\']').val()); }); </script> |