PageSourceSearch

https://www.kinnemaninsurance.com/img/~www.kinnemaninsurance.com/upgrade/js/validate-code.js

js kinnemaninsurance.com collected 2026-09-29 02:47:10 UTC 2,276 bytes, 93 lines download raw bytes

1$(document).ready(function(){
2	
3	//Checks if browser supports HTML5 validation
4	function hasFormValidation() {
5
6		return (typeof document.createElement( 'input' ).checkValidity == 'function');
7
8	};
9	//HTML5 validation
10	if( hasFormValidation() ) {
11		
12		//Validates fields
13		function validate() {
14			var errorNode = this.parentNode.querySelector( ".error" ),
15				span = document.createElement( "span" )
16			
17			this.classList.remove( "invalid" );
18
19			if ( !this.validity.valid ) {
20				this.classList.add( "invalid" );
21					return false;
22			}
23			else
24			{
25				console.log("field pass validation");
26			}
27		};
28		
29		//Loads fields into inputs and runs validate function on fields
30		function myInputs() {
31			var inputs = $("#simpleForm :input:not(:button)");
32			console.log(inputs);
33			
34			for ( var i = 0; i < inputs.length; i++ ) {
35			inputs[ i ].addEventListener( "blur", validate );
36			inputs[ i ].addEventListener( "invalid", validate );
37			};
38			clearInterval(myVar);
39		}
40		
41		var form = document.querySelector( "form" ),
42		myVar = window.setInterval(myInputs, 1000);
43		
44		// Turns off the default validation bubbles
45		form.addEventListener( "invalid", function( event ) {
46			event.preventDefault();
47		}, true );
48		
49	}
50
51	//Validation without HTML5
52	function validateForm(formParent,callback)
53	  {
54			var failed = false;
55			$(".sbmtfrm").each(function(index){
56				if($(this).val() == "")
57				{
58					$(this).css("background-color","pink");
59					failed = true;
60				}
61				else{
62					$(this).css("background-color","white");
63				}
64			});
65			if(failed)
66			{
67				return false;
68			}
69			else
70			{
71				return true;
72			}
73	  }
74	  
75	// Triggers form validation on submit before posting form
76	
77	$('#simpleForm').on('click','#qcfSubmit',function(e){
78		e.preventDefault();
79		if(validateForm("#simpleForm"))
80				{
81					submitForm();
82				}
83		
84	});
85});
86//Page functions =========================================================================================
87  
88function submitForm()
89   {
90		window.location='/contact.aspx?txtPrimaryFirst='+$("#txtFirstName").val()+'&txtPrimaryLast='+$("#txtLastName").val()+'&txtEmail='+$("#txtEmailAddress").val()+'&txtPhone='+$("#txtPrimaryNumber").val();
91   }
92   
93   

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.