I am trying to copy the text inside a <p>
element into an <input>
element's value
attribute.
The paragraph text contains .30, .31, .6, .38
, and this text is updated by a jQuery script without refreshing the page, so I need to update the <input>
's value
attribute each time with the new contents of the paragraph:
<p id="filter-display">.30, .31, .6, .38</p>
The input should look like this after updating it:
<input type="hidden" name="tags" value=".30, .31, .6, .38">
Is there any way that I can update the input's value attribute to reflect the paragraph's text each time it changes?