Use This code to Check URL is valid or not:
function validURL(str) { var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string '(\\#[-a-z\\d_]*)?$','i'); // fragment locator return !!pattern.test(str); }
Related Posts:
- When and why to ‘return false’ in JavaScript?
- Cross-Origin Read Blocking (CORB)
- How to replace innerHTML of a div using jQuery?
- What does [object Object] mean? (JavaScript)
- What does [object Object] mean?
- Remove class using jQuery
- How do I check whether a checkbox is checked in jQuery?
- How to make history.back() without getting a warning on the browser to reload the page?
- convert Hsl to rgb and hex
- How can I refresh a page with jQuery?
- How can I refresh a page with jQuery?
- Getting Error “Form submission canceled because the form is not connected”
- How to add jQuery code into HTML Page
- What does jQuery.fn mean?
- ajax jquery simple get request
- Javascript Runtime error: $ is undefined
- jQuery AJAX cross domain
- jQuery AJAX submit form
- Unable to preventDefault inside passive event listener
- SecurityError: Blocked a frame with origin from accessing a cross-origin frame
- jQuery $.cookie is not a function
- Setting background-image using jQuery CSS property
- What is causing the error `string.split is not a function`?
- Uncaught TypeError: data.push is not a function
- What is causing the error `string.split is not a function`?
- Uncaught TypeError: Cannot read property ‘top’ of undefined
- Scroll Automatically to the Bottom of the Page
- How do I check if string contains substring?
- How can I select an element by name with jQuery?
- How to check a radio button with jQuery?
- Get current URL with jQuery?
- jQuery disable/enable submit button
- TypeError: $(…).modal is not a function with bootstrap Modal
- How to add a “readonly” attribute to an ?
- JQuery $(“#content”).append not working
- Javascript TypeError: Cannot read property ‘indexOf’ of undefined
- using jQuery $(this).addClass not working, simple code not working
- HTML text input allow only numeric input
- How to use jQuery in chrome extension?
- JQuery issue “TypeError: $.getJSON is not a function”
- javascript function wait until another function to finish
- How to change value of object which is inside an array using JavaScript or jQuery?
- How to detect pressing Enter on keyboard using jQuery?
- Chrome/jQuery Uncaught RangeError: Maximum call stack size exceeded
- How to get height of div in px dimension
- jQuery: Uncaught Error: Syntax error, unrecognized expression
- How to use in jQuery :not and hasClass() to get a specific element without a class
- What is the best way to remove a table row with jQuery?
- Bootstrap popover is not working
- How to display raw JSON data on a HTML page
- How to call a webservice method from an html page [javascript] with out refresh the page
- How to get unique values in an array
- Only on Firefox “Loading failed for the script with source”
- How can I remove all CSS classes using jQuery/JavaScript?
- How to add a button dynamically using jquery
- jQuery if Element has an ID?
- Complex JSON nesting of objects and arrays
- jQuery – Increase the value of a counter when a button is clicked
- Get the size of the screen, current web page and browser window
- How to reload/refresh jQuery dataTable?
- Download a file by jQuery.Ajax
- How can I remove a style added with .css() function?
- How to use aria-expanded=”true” to change a css property
- Is there a way to enable Cross-Origin Resource Sharing for WordPress’ ajaxurl?
- jQuery UI Datepicker not working
- Draggable item in custom gutenberg block
- How to properly add Bootstrap and JQuery Javascripts?
- WP Admin missing icons, numerous JavaScript errors, but only when SCRIPT_DEBUG is false
- wpColorPicker: How update colors on input value update?
- How can I get my Calculate Contact Form 7 field to update with jQuery? [closed]
- Contact Form 7 – Uncaught TypeError: wpcf7.initForm is not a function [closed]
- Sending click events to Google Analytics in WordPress: the easy way
- How to embed JS data viz in a simple WordPress website
- Rhyzz Repeatable-fields javascript in php and wordpress
- window.onload wont execute in wordpress
- How to return multiple arguments from AJAX callback function
- JS news ticker is not working on home page but working on other pages. How to solve this?
- WP Customizer compare and set a value via javascript
- Why doesn’t jQuery use $, and how can I get it do so (GLOBALLY)?
- Plugin Scripts no loading on options page
- Using jquery and javascript in WordPress
- How to set javascript options for select2 in PHP array of plugin
- how to prevent added meta box from being injected with style=”position: fixed; top: 56px;” at scroll down
- Remove escape characters from JSON string pulled from a database
- How to make JQuery load on top of head tag before everything
- Show and hide element when URL contains certain section of text?
- Defer Parsing of Scripts
- Orderby post__in Not Working Correctly?
- Notify user we would like them to clear their cookie. Provide a working button to clear cookies for user
- Call full image url instead of stylsheet directory url in JS for Infinite Scroll Function
- comment-reply.js disables any other form javascript
- How to blur the_post_thumbnail() via blur.js (jquery)?
- Custom Javascript not working? [closed]
- How to deregister scripts all at once
- Add jQuery function to media button
- TypeError: $ is not a function Error using parallax effect in WordPress Template [duplicate]
- jQuery append only works if I select html in admin section [closed]
- Javascript Loading Effect to URLs
- Use WordPress Built In Jquery