javascript - How do I select all text contained in <pre> using jQuery? -
I have a content, editable iframe line numbers with line numbers and text in a div and all text < Code> & lt; Pre & gt; -element is in.
It looks like:
& lt; Body & gt; & Lt; Div id = "line_numbers" & gt; & Lt; Div & gt; 1 & lt; / Div & gt; & Lt; Div & gt; 2 & lt; / Div & gt; & Lt; Div & gt; 3 & lt; / Div & gt; & Lt; / Div & gt; & Lt; Pre & gt; Text & lt; / Pre & gt; & Lt; / Body & gt;
Now, when someone presses Ctrl + A everything is selected, which also includes line numbers. I & lt; Pre & gt; I would like to change this behavior to include the contents of
.
I have set a function that captures Ctrl + A and prevents the default operation. Now, I'll call & lt; Pre & gt;
?
will help me; You should be able to select the pre-element by using jQuery and pass it to the given function:
SelectText ($ ('pre') [0]);
Comments
Post a Comment