Sunday, September 6, 2015

auto highlight text on user click

As you have seen lot many websites where you click on the text or paragraph gets highlighted. Below code works to highlight the text using javascript which you can use any of your project where needed.
Step : 1 HTML

<textarea rows="3" id="txtarea" onClick="SelectAll('txtarea');" >    Click here to select this text.    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has   been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</textarea>

Step : 2 CSS

        height: 350px;
        border: 1px solid #ccc;
        background-color: #F3F3F3;

Step : 3 Javascript

function SelectAll(id)

No comments:

Post a Comment

Copyright © All rights reserved