JSFiddle - React, Tailwind, and code Playground

by kaleeswaran

HTML

<form>
    Text 1: <input type="text" id="input1" value="hello" /><br />
    Text 2: <input type="text" id="input2" value="world" /><br />
    Chk 1: <input type="checkbox" id="checkbox1" /><br />
    Chk 2: <input type="checkbox" id="checkbox2" checked="checked" />
</form>

JavaScript

$(document).ready(function(){
    var values = '';
    $('input[type=text],input[type=checkbox]').each(function(){
        if($(this).attr('type')=='text'){
            alert($(this).val());
        }
        if($(this).attr('type')=='checkbox'){
            alert($(this).attr('checked'));
        }
    });
});