I am working on a site where users can create and save their own HTML forms. Instead of inserting form elements and identifiers one by one into the database, I thought of using js (preferably jquery) to simply get the HTML form (in the source code format) and paste it into the text string via mysql.
For example, I have a form in a div
<div class="new_form"> <form> Your Name: <input type="text" name="something" /> About You: <textarea name=about_you></textarea> </form> </div>
With js, is it possible to get raw HTML in the div "new_form"?
To get all the HTML inside the div
$(".new_form").html()
To get only text, it will
$(".new_form").text()
, HTML, ( #, )
, innerHTML html(), , HTML-, . - , HTML.
innerHTML
html()
, , , , , , & - . IE, , HTML, , , . IE value.
&
value
, HTML-. , HTML .
Yes it is. You are using the innerHTML property for the div. Like this:
var myHTML = document.getElementById('new_form').innerHTML;
Source: https://habr.com/ru/post/1761832/More articles:Using scala to call java.util.Hashtable # put - hashtableHow to create Windows with WPF that looks like windows notification area in Windows 7? - .netWhat is the best way to create a HashMap string for a string vector in C ++? - c ++Dynamic DOM and jQuery - javascriptActionScript 3 loading external swf cast problem - flash-cs4Lua: subtracting decimal numbers does not return the correct precision - luaCannot get FlowLayoutPanel for extension - c #Working with XML in Delphi (returning certain data to a variable) - xmlC preprocessing magic - cRMagick с прямой формой, представленной Изображение от Sinatra - rubyAll Articles