JSFiddle - React, Tailwind, and code Playground

by devcurry_com

HTML

TextBox <br />
    <input id="txtBox" type="text" />
    <br /><br />
    Radio Button <br />
    <input type="radio"  name="rad" value="RadioOne"/> RadioOne
    <input type="radio"  name="rad" value="RadioTwo"/> RadioTwo
    <br /><br />
    Check Box <br />
    <input type=checkbox value="DotNetCurry">www.dotnetcurry.com<br />
    <input type=checkbox value="DevCurry">www.devcurry.com<br />
    <input type=checkbox value="SqlServerCurry">www.sqlservercurry.com
    <br /><br />
    Select Box <br />
    <select id="selectbox">
        <option>SelectOne</option>
        <option>SelectTwo</option>
        <option>SelectThree</option>
    </select>
    <br /><br /><br />
    <input id="btnSet" type="button" value="Set Values" />
    <input id="btnGet" type="button" value="Get Values" 
        disabled="disabled" />

    <p id="para"></p>

<br/><br/> <br/>
   <p>Demo by <a href="http://www.devcurry.com/search/label/jQuery">DevCurry.com</a> </p>

JavaScript

$(function () {
        // Set values of form elements
        $("#btnSet").click(function () {
            $("#txtBox").val("Some text for TextBox");
            $("input:radio").val(["RadioTwo"]);
            $("input:checkbox").val(["DotNetCurry", "DevCurry"]);
            $("#selectbox").val("SelectTwo");
            $("#btnGet").removeAttr('disabled');
        });

        // Get values of form elements
        $("#btnGet").click(function () {
            // first get the multiple selected checkbox items
            var chk = [];
            $("input:checkbox:checked").each(function() {
                chk.push($(this).val());
            });

            $("#para").html(
                $("#txtBox").val() + "<br/>" +
                $("input:radio[name=rad]:checked").val() + "<br/>" +
                chk.join(",") + "<br/>" +
                $("#selectbox").val()
             );
        });

    });