如何在<code> element or <blockquote> element?

时间:2017-02-14 07:22:19

标签: javascript jquery html

I am trying to select all the text with a <code> or HTML element. I have tried a lot of things but I think that jQuery .select() only works for input boxes.

jQuery('code').click(function () {
  jQuery(this).select(); // text should now be highlighted in the browser
});

My HTML

<code>.alpha{}</code>
<code>Some other code element on the page.</code>
<blockquote>A famous quote</blockquote>

It should select and highlight the text

enter image description here

0 个答案:

没有答案