Select all div text in single click in JavaScript

Here is the code for selecting a div content through javascript with single click of button or mouse click, just copy and paste javascript code given bellow and call the function selectText at the button click and pass the parameter divid.

Try Demo Here Click Select:-

<script type="text/javascript">

        function selectText(divid) {
            if (document.selection) {
                var div = document.body.createTextRange();

            else {
                var div = document.createRange();




Recent Posts