Follow us on Youtube.  | Follow Website !

Search Suggest

How to add auto selecting on Blogger



What's up NQnia lover? In this tutorial, you will talk about how to add auto-selection on Blogger. Let's tell you what is auto-selection. Auto-selection is one kind of script if you use this script you will able to add select text option for demo scroll down and click on any code box of this post. Now follow all the steps of this post to add auto-selecting text.
Go to Blogger dashboard - Theme - three-dot - Edit HTML. Now search for </body> tag and add the belowe code after </body> tag.



<script>
// Selection
function autoSelect(elem) {
var selection, range;
if (window.getSelection) {
selection = window.getSelection();
range = document.createRange();
range.selectNodeContents(elem);
selection.removeAllRanges();
selection.addRange(range);
} else if (document.selection) { // IE
selection = document.selection.createRange().text;
range = document.body.createTextRange();
range.moveToElementText(elem);
range.select();
}
}
$('pre,kbd').on("click", function() {
autoSelect(this);
});
//]]>
</script>



Now how to add auto-section on Blogger post. Just with pre kbd code and done.
ex. <pre>Paste code....</pre> , <kbd>Paste Code...</kbd>

Post a Comment