1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <title>required attribute presence test
</title>
5 <script src=
"../../resources/js-test.js"></script>
8 <p id=
"description"></p>
9 <div id=
"console"></div>
10 <input id=
"input" name=
"victim" required
/>
11 <textarea id=
"textarea" name=
"victim" required
></textarea>
12 <select id=
"select" name=
"victim" required
>
13 <option value=
"" selected
/>
14 <option value=
"X">X
</option>
16 <script language=
"JavaScript" type=
"text/javascript">
17 function requiredFor(id
) {
18 return document
.getElementById(id
).required
;
21 description("There are three form control elements below, all required.");
23 v
= document
.getElementsByName("victim");
25 shouldBeTrue('requiredFor("input")');
26 shouldBeTrue('requiredFor("textarea")');
27 shouldBeTrue('requiredFor("select")');