so I have an HTML page, a linked Javascript(jQuery actually) file that has functions linked to clicks, etc. Then I want to add Regular Expressions to check user input. I want to maintain all JS Regular Expressions in one separate file, so that it is easy to manage, in case I add new Regular Exspressions. I tried using Import/Export, but I am getting errors like: Uncaught SyntaxError: Unexpected token 'export' (at 99_JS_Regex.js:1:1) Uncaught SyntaxError: Cannot use import statement outside a module (at 01_JScript_Main.js:3:7)
Here are the files:
File 99_JS_Regex:
export JS_Email_RG = "/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/";
File 01_JScript_Main.js:
(document).ready(function(){
$("#Login_Button").click(function(){
import JS_Email_RG from './99_JS_regex.js';
alert JS_EM_RG;
});
});
Also, I am not sure how to specify the path to the module file.. is it './module_file.js' or should I simply put 'module_file.js' or "'module_file.js'". many thanks...