Skip to main content

Posts

Mortgage simulator app in Javascript

Input text in Javascript

HTML input tag Get Input value Concat strings We are displaying an input box for the user to input their name. When clicking a button we display the name in a HTML element. Sample: http://javascript.kennyming.com/code/3-input-text-javascript/ Code: https://github.com/kennymingt/javascript/tree/master/code/3-input-text-javascript

Using Buttons in JavaScript

Console message for debug Constants Add Events listeners to DOM Elements functions We are going to display a message when we click a button. We have two elements with Id in the HTML, the button and a div to display a message. In our JavaScript file we grab a reference to elements in the HTML. We add a function to the Click event of the button. Sample: http://javascript.kennyming.com/code/2-buttons-in-javascript/ Code: https://github.com/kennymingt/javascript/tree/master/code/2-buttons-in-javascript

Displaying text in Javascript

Create a basic html Set the page title Display static header text Include a Javascript file in our html Get a reference to an html element and change its text content. The html page for the application. We will use a div to display text to the user. We set an id for the div so we can grab it from Javascript. And we also include our Javascript file. That’s it. We can open our index.html file in chrome, just double click it, and we will see our hello world! message displayed on the webpage. Sample Page: http://javascript.kennyming.com/code/1-displaying-text/ Sample Code: https://github.com/kennymingt/javascript/tree/master/code/1-displaying-text