Cara Memasang Seleksi Otomatis Pada Tag Pre & Code
1. Buka blog anda > ke beranda blog > template > edit HTML
2. Cari kode
2. Cari kode
</head>
atau
</body>
3. Letakkan kode di bawah ini diatas kode
</head>
atau
</body>
<script type='text/javascript'>
//<![CDATA[
//Pre Auto Selection
$('i[rel="pre"]').replaceWith(function() {
return $('<pre><code>' + $(this).html() + '</code></pre>');
});
var pres = document.querySelectorAll('pre,kbd,blockquote,i');
for (var i = 0; i < pres.length; i++) {
pres[i].addEventListener("dblclick", function () {
var selection = getSelection();
var range = document.createRange();
range.selectNodeContents(this);
selection.removeAllRanges();
selection.addRange(range);
}, false);
}
//]]>
</script>
4. Klik simpan
Silakan di coba membuat syntax, sehabis itu coba double klik apa yang terjadi & apa perubahannya
Demikian post ini saya share, semoga berguna bagi anda semuanya.

0 comments:
Silakan Komentar Sesuai Topik Di Atas