I want to know the best way to write the same thing once and repeat within the same page. For example:
& lt; Div & gt; & Lt; P id = "description1" & gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt; Div & gt; & Lt; P id = "description1" & gt; & Lt; / P & gt; & Lt; / Div & gt; -
I just want to write inside description1
body
. I think it can be obtained using Dome.
First of all, the id field should be unique element.
If you assign all tags to a square and lt; P class = "description" & gt; & Lt; / P & gt;
, you can use jQuery to set them up by calling:
$ ('Description'). Text ('this is the text')
In Javascript:
Miscellaneous Elements = Document. GetElementsByClassName ("Description"); (Var i = 0; i & lt; elements.length; i ++) {element [i] .innerHTML = "This is the text."; }
No comments:
Post a Comment