Ex: Greetings of the Day Mr/Ms. XXXX // Can get same greeting in whatever the language you want.
Install
$ npm install greetr
Usage
// app.js// gets a new object (the architecture allows us to not have to use the 'new' keyword here)varg=G$('John','Doe');// use our chainable methodsg.greet().setLang('es').greet(true).log();// let's use our object on the click of the login button$('#login').click(function(){// create a new 'Greetr' object (let's pretend we know the name from the login)varloginGrtr=G$('John','Doe');// hide the login on the screen$('#logindiv').hide();// fire off an HTML greeting, passing the '#greeting' as the selector and the chosen language, and log the welcome as wellloginGrtr.setLang($('#lang').val()).HTMLGreeting('#greeting',true).log();});// HTML to be<html><head></head><body><divid="logindiv"><selectid="lang"><optionvalue="en">English</option><optionvalue="es">Spanish</option></select><inputtype="button"value="Login"id="login" /></div><h1id='greeting'></h1><scriptsrc=""></script> // include jQuery<scriptsrc=""></script> // include Greetr.js<scriptsrc="app.js"></script></body></html>
👋 Here you go!!
Play around 💻 with different languages you know by editing Greetr.js library file. Currently we are supporting English and Spanish.