forked from ryanmwangi/CalMerger
add function to validate URL format
This commit is contained in:
parent
28335713f3
commit
7c19b8d12c
|
@ -3,7 +3,13 @@ const form = document.getElementById('merge-form');
|
||||||
const addCalendarButton = document.getElementById('add-calendar');
|
const addCalendarButton = document.getElementById('add-calendar');
|
||||||
const result = document.getElementById('result');
|
const result = document.getElementById('result');
|
||||||
|
|
||||||
let calendarIndex = 1;
|
let alendarIndex = 1;
|
||||||
|
|
||||||
|
// Function to validate URL format
|
||||||
|
function isValidUrl(url) {
|
||||||
|
const urlPattern = /^(https?:\/\/[^\s$.?#].[^\s]*)$/; // Regex for URL validation
|
||||||
|
return urlPattern.test(url);
|
||||||
|
}
|
||||||
|
|
||||||
addCalendarButton.addEventListener('click', () => {
|
addCalendarButton.addEventListener('click', () => {
|
||||||
const newCalendar = document.createElement('div');
|
const newCalendar = document.createElement('div');
|
||||||
|
|
Loading…
Reference in New Issue