JSFiddle - React, Tailwind, and code Playground

by denniswaltermartinez

HTML

<h1>Please enter your work experience(years)</h1>

<input id="ageInput" type="number">
 <h1>Please enter your salary($)</h1>

<input id="salaryInput" type="number">
 <h1>Please enter your name</h1>

<input id="nameid" type="text">
<input type="button" value="Submit">

JavaScript

function doStuff() {
    console.log('ad');
    var name = $('#nameid').val(),
        age = parseInt($('#ageInput').val(), 0),
        salary = parseInt($('#salaryInput').val(), 0),

        // msg
        text = '';

    text += '<h2>' + name + '</h2>';
    text += '<h2>Age experience:\t' + age + '</h2>';
    text += '<h2>Starting salary:\t' + salary + '</h2>';

    function increaseSalary(amount) {
        salary += (salary * amount) / 100;
        return salary
    }

    if (age >= 3 && age < 10) {
        salary = increaseSalary(10);
        text += '<h4>Proceeding from work experience the new salary was increase by 10%:\t' + salary + '<\h4>';
    } else if (age >= 10 && age < 20) {
        salary = increaseSalary(10);
        text += '<h4>Proceeding from work experience the new salary was increase by 25%:\t' + salary + '<\h4>';
    } else if (age >= 20) {
        text += '<h4>Proceeding from work experience you get a prize:<\h4>';
        text += '<img src="http://3.bp.blogspot.com/-2T_AGEs19_4/T_c2ERHsJeI/AAAAAAAIK9E/MGAQAa9ppDE/s800/2013-Mercedes-G-Class-AMG-011.jpg">';
    } else {
        text += '<h4>Proceeding from work experience the  salary is:\t' + salary + '<\h4>';
    }

    $('body').html(text);
}

$(document).on('click', 'input[type="button"]', doStuff);