-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
102 lines (79 loc) · 4.04 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
$(document).ready(function() {
var slides = [
{
image: "./images/Clip path group.png",
label: "Comprehensive car insurance policy",
para1: "Comprehensive car insurance, also known as a private car package policy, is a type of auto insurance that provides complete coverage for your vehicle. It is an optional car insurance policy but is highly recommended for car owners who want the best protection for their four-wheelers.",
para2: "Comprehensive car insurance covers damage caused by natural disasters, accidents, theft, fire, and other such incidents. It covers damages to both your vehicle and third-party vehicles and property. This car insurance policy also covers third-party liabilities, which will cover any legal costs or compensation you may be liable for in case of an accident caused due to your fault. In addition, some comprehensive policies also offer additional benefits such as roadside assistance, towing service, and more. Even though comprehensive insurance policies tend to be more expensive than Third-Party Liability or Standalone Own Damage policies, they offer broader coverage."
},
{
image: "./images/Clip path group.png",
label: "Another Car Insurance Option",
para1: "This is another type of car insurance that offers partial coverage and lower premiums.",
para2: "This insurance covers specific types of incidents like collisions or theft but not damages from natural disasters."
},
{
image: "./images/Clip path group.png",
label: "thired Car Insurance Option",
para1: "This is another type of car insurance that offers partial coverage and lower premiums.",
para2: "This insurance covers specific types of incidents like collisions or theft but not damages from natural disasters."
}
];
var currentIndex = 0;
function updateSlide() {
$('#slide-container').fadeOut(300, function() {
$('#slide-img').attr('src', slides[currentIndex].image);
$('#desc-label').text(slides[currentIndex].label);
$('#desc-para1').text(slides[currentIndex].para1);
$('#desc-para2').text(slides[currentIndex].para2);
$('#slide-container').fadeIn(300);
});
}
$('#next-btn').click(function() {
currentIndex = (currentIndex + 1) % slides.length;
updateSlide();
});
$('#prev-btn').click(function() {
currentIndex = (currentIndex - 1 + slides.length) % slides.length;
updateSlide();
});
updateSlide();
$('#quoteForm').submit(function(event) {
let isValid = true;
$('#successMessage').text('');
$('#errorMessage').text('');
const carRegistration = $('#carRegistration').val();
if (!carRegistration) {
alert('Please enter your car registration number.');
isValid = false;
}
const mobile = $('#mobile').val();
const mobilePattern = /^\d{10}$/;
if (!mobilePattern.test(mobile)) {
alert('Please enter a valid 10-digit mobile number.');
isValid = false;
}
const email = $('#email').val();
const emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
if (!emailPattern.test(email)) {
alert('Please enter a valid email address.');
isValid = false;
}
const terms = $('#terms').prop('checked');
if (!terms) {
alert('You must agree to the terms and conditions.');
isValid = false;
}
if (isValid) {
event.preventDefault();
$('#successMessage').text('Login successful!').css('color', 'green');
alert('Form submitted successfully!');
} else {
event.preventDefault();
$('#errorMessage').text('Please fix the errors above and try again.').css('color', 'red');
}
});
$("#read-All-review").click(function() {
$(".reviewHide").toggleClass("d-none");
});
});