How to add auto selecting on Blogger

What's up Tech 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>technomania</pre>,<kbd>technomania</kbd>

Comments

Popular posts from this blog

Gove confirms mandatory housebuilding targets for councils will be abolished in face of Tory rebellion – UK politics live

Kotak Mahindra Bank Recruitment 2022 Released for Graduate Candidates And Apply Online