- Prototype Tutorial
- Prototype - Home
- Prototype - Short Overview
- Prototype - Useful Features
- Prototype - Utility Methods
- Prototype - Element Object
- Prototype - Number Processing
- Prototype - Strings Processing
- Prototype - Array Processing
- Prototype - Hash processing
- Prototype - Basic Object
- Prototype - Templating
- Prototype - Enumerating
- Prototype - Event Handling
- Prototype - Form Management
- Prototype - JSON Support
- Prototype - AJAX Support
- Prototype - Expressing Ranges
- Prototype - Periodical Execution
- Prototype Useful Resources
- Prototype - Quick Guide
- Prototype - Useful Resources
- Prototype - Discussion
Prototype - $F() Method
The $F() function returns the value of any field input control, like text boxes or drop-down lists. This is a convenience alias of Form.Element.getValue.
The function can take as argument either the element id or the element object itself.
Syntax
$F(element)
Return Value
Form's element Value.
Example
<html> <head> <title>Prototype examples</title> <script type = "text/javascript" src = "/javascript/prototype.js"></script> <script> function ShowValue() { var value = $F('userName'); alert( 'Entred Value :' + value); } </script> </head> <body> <p>Enter any value in the box and then click "Show Value"</p> <form> <input type = "text" id = "userName" value = "Madisetti, Praveen"> <br/> <input type = "button" value = "Show Value" onclick = "ShowValue();"/> </form> </body> </html>
Output
prototype_utility_methods.htm
Advertisements