html tutorial - onselect Attribute in HTML - html5 - html code - html form

Onselect attribute in html

Learn html - html tutorial - Onselect attribute in html - html examples - html programs

  • The onselect attribute specifies after a part of text has been selected in the element.
  • onselect attribute is a part of the Event Attributes.

Syntax for onselect attribute in HTML:

<element onselect=”script">

Applies To:

Element Attribute
All HTML Element onselect

Attribute Values:

Value Description
script The script can run on onselect

Sample Coding for onselect Attribute in HTML:

Tryit<!DOCTYPE html>
         <title>Wikitechy onselect attribute</title>
    <body>Enter the text: 
      <input type="text" value="Wikitechy tutorials!!" onselect="onSelect()">
      function onSelect() 
        alert("You are selected the Wikitechy tutorials!");

Code Explanation for onselect Attribute in HTML:

onselect Attribute Code Explanation

  1. The onselect attribute is used to call the onSelect() JavaScript function when the user try to select the text in the textbox.
  2. The onSelect() function used to display an alert message.

Output for onselect Attribute in HTML:

onselect Attribute Tag Output

  1. The term Wikitechy tutorials!! is displayed which can be selected.
  2. After selecting the Wikitechy tutorials!! the alert box has been displayed with the message "You are selected the Wikitechy tutorials!".

Browser Support for onselect Attribute in HTML:

Yes Yes Yes Yes Yes

Related Searches to onselect Attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add to your ad blocking whitelist or disable your adblocking software.