In Polymer (1.0), how can I set the focus of the iron-input when (as example) radiobutton 'radio1' is selected.
<div>
<div>Title:</div>
<paper-radio-group>
<paper-radio-button name="radio1">Radio1Label</paper-radio-button>
<paper-radio-button name="radio2">Radio2Label</paper-radio-button>
</paper-radio-group>
<paper-input-container>
<input is="iron-input">
</paper-input-container>
</div>
You will need to bind a click event to
radio1
:Then define the function
_setInputFocus
so that it selects the input and sets the focus to it:EDIT: Now we want the input disabled until the user selects the radio button. So we give the
iron-input
thedisabled
attribute:Then we change our JavaScript function so that we remove the
disabled
attribute and sets the input focus: