Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

radio button form validation

function validateForm() {
    var radios = document.getElementsByName("yesno");
    var formValid = false;

    var i = 0;
    while (!formValid && i < radios.length) {
        if (radios[i].checked) formValid = true;
        i++;        
    }

    if (!formValid) alert("Must check some option!");
    return formValid;
}​
Comment

PREVIOUS NEXT
Code Example
Javascript :: Tow sums 
Javascript :: Function Returning Object Saved To A Variable 
Javascript :: es6 spread operator 
Javascript :: get id from javascript function call 
Javascript :: Backbone This Will Give Error 
Javascript :: react with two components render 
Javascript :: how to use session with cookie js nodejs 
Javascript :: js extend list 
Javascript :: Combine multiple JSONs Into One 
Javascript :: javascript code for adding scroll to top of page 
Javascript :: JS in JSX. Whenever you need to add some JS, just put it inside curly braces {} 
Javascript :: How to Add Main Module API to Renderer process 
Javascript :: use stigviewr 
Javascript :: how to style on-click in react/ vuejs router 
Javascript :: react native uncaught error main has not been registered stackoverflow 
Javascript :: Listen to custom event in Vue js 
Javascript :: make navigation open when items are active 
Javascript :: sort array based on subarray value 
Javascript :: how to confirm if angular js in installed 
Javascript :: cefsharp transparent background 
Javascript :: Search an elemnt in a sorted and rotated array 
Javascript :: check if a number is multiple of 3 javascript 
Javascript :: hreroku 
Javascript :: Make a Responsive Portfolio Website: JavaScript and HTML 
Javascript :: correct code for the { "vars": "local" } 
Javascript :: js execute after running the html file 
Javascript :: submit form on ctrl enter 
Javascript :: select inputs without specific type js 
Javascript :: json to list react 
Javascript :: how to use same component in multiple place with some logic in angularjs 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =