Is it possible to select all the text of an element (e.g., a paragraph <p>
) with JavaScript? A lot of people think jQuery .select()
would do this, but it does not. It merely triggers an event. Note that DOM objects for <input>
elements have a native select()
method, but most other elements (such as <output>
and <p>
) do not.
(Do I need to use content-editable
to get this to work?)
.html()
or.text()
, or highlight the text as if you did with your mouse by dragging? – Willem<input />
– Parenteral