Get Radio Button Value with Javascript jQuery $('input[name="inputname"]:checked').val(); Javascript var radios = document.getElementsByName('inputname'); for (var i = 0, length = radios.length; i < length; i++) { if (radios[i].checked) { // do whatever you want with the checked radio alert(radios[i].value); // only one radio can be logically checked, don't check the […]

Get Radio Button Value with Javascript jQuery

Javascript Code <script type=”text/javascript”>function validate() { if ((!document.getElementById(‘gender’).checked) && (!document.getElementById(‘genderf’).checked))    {        alert(“select gender”);    }}</script> HTML Code <form name=”form” id=”form” method=”post” onsubmit=”validate();”>    <input type=”checkbox” name=”check” id=”tnc” /> I accept all terms and conditions.<br/>      Male <input type=”radio” name=”gender” value=”male” id=”gender” class=”gender” />    Female […]

check if checkbox is checked or not in javascript

validation of file extension before uploading file in javascript HTML CODE <form method=”post” onsubmit=”validate(this);”>    <input type=”file”>    <input type=”submit” value=”submit”></form> JAVASCRIPT CODE function validate(ranvirForm){    var allowedExtentions = [“.jpg”, “.jpeg”, “.pdf”, “.png”];  // allowed extenstions array    var input_arr = ranvirForm.getElementsByTagName(“input”);    for (var i = 0; i < […]

validation of file extension before uploading file in javascript

Copy below code and save in html file then open in browser <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”> <html xmlns=”” dir=”ltr”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ /> <title>jQuery | Pop up submit form</title> <link rel=”stylesheet” href=”general.css” type=”text/css” media=”screen” /> <script src=””></script> <style> blockquote, q { quotes:”” “”; } […]

jquery multipurpose popup e.g login or register

<html xmlns=””><head> <meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ /> <title>testing file</title> <style> #clockDiv { float:right; border:solid 1px #999; color:#FFF; background:#000;}    </style></head><body onload=”clock();”><script type=”text/javascript”>function clock() {   var now = new Date();   var outStr = now.getHours()+’:’+now.getMinutes()+’:’+now.getSeconds();   document.getElementById(‘clockDiv’).innerHTML=outStr;   setTimeout(‘clock()’,1000);}clock();</script> <div id=”clockDiv”></div></body></html>

code for jquery time as digital clock

Javascript code <script type=”text/javascript”>function validateEmail(){ var emailValue = document.getElementById(’email’).value; var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}$/i; if(emailRegEx.test(emailValue)){ alert(“Valid email”); return true; }else{ alert(‘Invalid email’); return false; }}</script> HTML Form <form name=”myform” onsubmit=”validateEmail();” method=”post”> Email : <input type=”text” name=”email” id=”email”  /><br /> <input type=”submit” value=”Submit” /> </form>

code for validating Email format in javascript