Multiple tag on select all jquery
by kompiajaib
HTML
<blockquote>
A lot of code goes here<br/>
Many lines of code or whatever
</blockquote>
<pre>
A lot of code goes here<br/>
Many lines of code or whatever
</pre>
<div class="kode">
A lot of code goes here<br/>
Many lines of code or whatever
</div>
CSS
blockquote{font:italic 14px Georgia;margin:10px 25px;padding:10px;line-height: 1.6em;color: #333;background: #ddd;border-left: 3px solid #aaa;transition:all .3s ease-in-out;position:relative;-webkit-touch-callout: text;-webkit-user-select: text;-moz-user-select: text;-ms-user-select: text;-o-user-select: text;user-select: text;}
blockquote:hover{background: #eee}
pre {color:#126AAF;margin:15px 25px 15px;padding:10px;clear:both;background:#f2f2f2;color:#666;border:1px solid #ddd;border-left:3px solid #bbb;overflow:auto;font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;font-weight: normal !important;font-style: normal !important;font-size: 12px !important;}
.kode{border:#666 1px solid; padding:10px;}
JavaScript
var pres = document.querySelectorAll('blockquote,pre,.kode');
for (var i = 0; i < pres.length; i++) {
pres[i].addEventListener("click", function () {
var selection = getSelection();
var range = document.createRange();
range.selectNodeContents(this);
selection.removeAllRanges();
selection.addRange(range);
}, false);
}