Link to home
Create AccountLog in
Avatar of RadhikaVyas
RadhikaVyasFlag for India

asked on

Textbox validation using javascript for null value

HI

I want two sets of textboxes in two radio buttons click....I want to validate that textboxes in radio button check for nullability...whether textbox is null.....pls help.....Using javascript how to validate that textbox to check for nullability..
Avatar of Jagdish Devaku
Jagdish Devaku

In the checkbox HTML set: <.... onclick="myFunction(this.name)">
Then insert this script:
<script language="JavaScript">
<!--
function myFunction(myFNM) {
if (document.getElementById(myFNM).value == "") {
(your actionA)
} else {
(your actionB)
}
--> </script>
Is this what you intended to do...?
you may use this also

 var Str = document.getElementById(TxtID).value

 if (Str.length <= 0)
    {  
       
        return false;
    }
ASKER CERTIFIED SOLUTION
Avatar of Jon Norman
Jon Norman
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer