Getting the value of a form element

日本語のページ

If a web page contains input forms, you can retrieve the values ​​of the elements within those forms.
This page explains the procedure for doing so.

For text input elements and select elements

You can programmatically retrieve the text entered into text input elements (such as `<input type="text">` or `<textarea>`) or the item selected in a `<select>` element.
To do this, use the "get value of XXX" block.
Specify the target input element using the "XXX" parameter.

Get value

For checkboxes and radio buttons

You can programmatically retrieve the checked state of checkboxes (`<input type="checkbox">`) or radio buttons (`<input type="radio">`).
To do this, use the "get the checked property of XXX" block.
Specify the target checkbox or radio button using the "XXX" parameter.

Get checked

Text of the item selected in a select element

You can retrieve the text of the item selected in a `<select>` element (the "XXX" part of `<option value="...">XXX</option>`).
To do this, use the "The string of the item selected by select XXX" block.
Specify the target `<select>` element using the "XXX" parameter.

Get selected text

Getting the selected value from radio buttons

You can retrieve the value of the selected radio button from within a group of radio buttons.
To do this, use the block labeled "value of the checked item on radio button XX."

Get value of checked item

For the "XX" parameter, use the selector `input[name="□□"]` to specify the element representing the group of radio buttons.
For example, suppose you have assigned a browser window to a variable named `win`.
And suppose the web page displayed in that browser contains radio buttons with the name attribute set to "rdo".
In this case, use the block that retrieves an element within the window using a selector, and specify `input[name="rdo"]` as the selector.

Get the value of the selected item from the radio button with the name attribute "rdo"