This page describes a function of the Prototype Java Script framework.

The Prototype $F function provides a convenient shortcut to the value of any field by their id or directly by the object itself.

Syntax


  $F('myinput')  // returns the value of the field with id 'myinput'

Examples


<p><input type="text" id="myinput" value="Hello World" /></p>
<p onclick="demoDollarF_1()">Click here! (with string)</p>
<p onclick="demoDollarF_2()">Click here! (with element object)</p>
<p onclick="demoDollarF_3()">Click here! (with .value - not $F)</p>

<script language="JavaScript">
function demoDollarF_1() {
 alert('With string: ' + $F('myinput'));
}
function demoDollarF_2() {
 var element = $('myinput');
 alert('With element object:' + $F(element));
}
function demoDollarF_3() {
 alert('With .value:' + $('myinput').value);
}
</script>

Demo:

Click here! (with string)

Click here! (with element object)

Click here! (with .value - not $F)