-
-
Notifications
You must be signed in to change notification settings - Fork 722
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Possible fix for a 'selectOption' issue (#408)
* No longer cycles through different options - just selects the first one. * Fixed to pass existing tests and added a new test requiring changes. * Tidied up the new test. * More tidying of new test.
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<html> | ||
<body> | ||
<form action="/form/complex" method="POST"> | ||
<label> | ||
<div>Select a value:</div> | ||
<div> | ||
<select name="select" id="select"> | ||
<option value=""></option> | ||
<option value="option1">Option 1</option> | ||
<option value="option2">Option 2</option> | ||
<option value="option3">Option 3</option> | ||
</select> | ||
</div> | ||
</label> | ||
<input id="submit" disabled="disabled" type="submit" value="Submit" /> | ||
</form> | ||
<script> | ||
document.getElementById('select').addEventListener('change', function() { | ||
var submit = document.getElementById('submit'); | ||
if (this.value === "") { | ||
submit.setAttributeNode("disabled", "disabled"); | ||
} else { | ||
var disabled = submit.getAttributeNode("disabled"); | ||
submit.removeAttributeNode(disabled); | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters