Quick Start
One page summary of how to use JPigLatin
Installation
- Via CDN
Replace version with current version, i.e 1.0.3
<script src="https://unpkg.com/jpiglatin@VERSION/index.js"></script>
- Via NPM
npm i jPigLatin -save
Use
- Include jPigLatin in page source
<script src="https://unpkg.com/jpiglatin@1.0.0/index.js"></script>
- Create two fields, one for user input and one for output
<span id="input">This is a test</span>
<span id="output"></span>
- Use javascript to get pass input to jPigLatin
encode()
function. Set input and output ElementID’s with local variables.
<script>
function displayPigLatin(){
var input = "input";
var output = "output";
document.getElementById(output).innerHTML = encode(input,output);
}
</script>
- Use an event loader to execute function
<button onclick="displayPigLatin()">Translate</button>
Code Pen Example
See the Pen JPigLatin | JavaScript Pig-Latin Encoder by Tyler Butler (@tcbutler320) on CodePen.