getting radio , check box in prototype?
how can i get the checkbox, radio button, pu开发者_StackOverflow社区lldown menu values using id with using form in prototype js?
See $F
Edit
$F
get's the text value of an element by it's ID. For example if you had a drop down select box called "month" you could use $F('month')
to get it's value "February".
In response to your follow up question, "how can i get the count of number of check box is selected" use this:
$$('input:checked').length
$F
returns the value of a form field.
Given
<input id="field1" name="field1" value="foo">
This is true:
$F('field1') == 'foo'
Given
<input type="checkbox" name="mycheckbox1" id="mycheckbox1" value="ABC" checked/>
<input type="checkbox" name="mycheckbox2" id="mycheckbox2" value="DEF"/>
This is true:
$F('mycheckbox1') == "ABC"
$F('mycheckbox2') == null
精彩评论