JSFiddle - React, Tailwind, and code Playground

by saravanan

HTML

<input type="text" class="a" value="" />

<input type="button" id="b1"  value ="click me"/>

JavaScript

// to check how the value of an emtpy text box is recevied at Javascript

$("document").ready(function() {

    $("#b1").click(function() {

        if (jQuery.trim($(".a").val())) {
            console.log("a has some value");
        }
        else {
            console.log("a has no value");
        }
        console.log($(".a").val());
    });
});