patch for jquery url validator working
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
console.log("-------------EXAMPLEEEEE----------------- :)");
|
||||
console.log("PLGNTLS_data:");
|
||||
console.log(PLGNTLS_data);
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
console.log("-------------jquery----------------- :)");
|
||||
// https://stackoverflow.com/questions/24938890/wordpress-jquery-noconflict
|
||||
// https://wordpress.stackexchange.com/questions/104510/how-to-add-jquery-script-to-an-individual-page
|
||||
// https://developer.wordpress.org/reference/functions/wp_enqueue_script/#jQuery_noConflict_Wrappers
|
||||
//(function($) {
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
|
||||
$.validator.addMethod
|
||||
(
|
||||
'validUrl',
|
||||
function(value, element)
|
||||
{
|
||||
var url = $.validator.methods.url.bind(this);
|
||||
return url(value, element) || url('http://' + value, element);
|
||||
},
|
||||
'Please enter a valid URL'
|
||||
);
|
||||
|
||||
} );
|
||||
//})(jQuery);
|
||||
8
plugins/fipfcard_plugin/js/jquery_validator_url_patch.js
vendored
Normal file
8
plugins/fipfcard_plugin/js/jquery_validator_url_patch.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// https://stackoverflow.com/questions/12741517/how-to-make-url-validation-without-http-or-add-it-after-validation-passed/44848476#44848476
|
||||
|
||||
let old_url = jQuery.validator.methods.url;
|
||||
jQuery.validator.addMethod( 'url', function(value, element) {
|
||||
let url = old_url.bind(this);
|
||||
return url(value, element) || url('http://' + value, element);
|
||||
}, 'Please enter a valid URL'
|
||||
);
|
||||
Reference in New Issue
Block a user