Aria live error handling

From Level Access Web Labs
Revision as of 00:48, 10 June 2014 by Mrekhi (talk | contribs)
Jump to navigation Jump to search

<htm lang=en-us> <head>

<script type="text/javascript"> // function to display constraints as well as error messages. function myFunction(){

document.getElementById("errMsg").style.display="block"; document.getElementById("errMsg2").style.display="block"; document.getElementById("top").focus(); } // function validating the username text field and displaying an error is the value is 't' function check () { var txtValue = document.getElementById("uname").value;

if (txtValue == "t"){ document.getElementById("errMsg2").style.display="block"; document.getElementById("uname").focus();} else { document.getElementById("btnSubmit").focus(); } }


</head> <body>

<label id="myLbl" for="x">Email <input type="text" id="x" aria-describedby="z"/>


This is the constraint pop-up

<label id="myLbl2" for="uname">Username <input type="text" id="uname" aria-describedby="constraint2" onblur="check();"/>


This is the constraint pop-up for username

<button id="btnSubmit" onclick="myFunction();">click me</button>

</body> </html>