Tutorials Point


  Learn Prototype
  Prototype Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

Prototype Form.Element select() Method


previous next AddThis Social Bookmark Button


Advertisements

This method selects the current text in a text input.

Syntax:

formElement.select();

Return Value :

  • It returns selected HTMLElement

Example:

<html>
<head>
<title>Prototype examples</title>
   <script type="text/javascript" 
   src="/javascript/prototype.js">
   </script>
<script>

function showResult()
{
  var elem = $('searchbox');
  Form.Element.select(elem)
}

</script>
</head>

<body>

  <p>Enter some value click the button to see the result.</p>
  <br />

  <form id="example" action="#">
  <fieldset>
  <div>
      <label for="searchbox">Search</label>
      <input id="searchbox" name="searchbox" type="text">
  </div>

  <div <input value="Result" type="button" onclick="showResult();>
  </div>
  </fieldset>
  </form>

</body>
</html>

To understand it in better way you can Try it yourself.



previous next Printer Friendly

Advertisements


  

Advertisements