i created a condition that when a button is clicked, it will get the value of my ID from <input id="id" class="req">
box, and will display the associated name of that ID and put it in Name<input id="name" class="req">
box.
so when i type 1
, i will get BOB
. pretty basic.
i also have a condition, that both <input>
box should have values, before a specific <div>
will appear. so by default this <div>
is hidden.
the part im struggling is, whenever i click the button, then i get the name, even though, i have successfully filled my 2 <input>
boxes, the <div>
still wont appear.
this is my code.
//<input> conditions
$('input.req').on("keyup keypress change", function () {
$('input.req').each(function() {
if($(this).val() != "") {
$("#content").show();
}
else {
$("#content").hide();
}
});
});
again, if you type 1, you will get bob. but the <div>
wont show up. but if you manually, fill in the textboxes, the <div>
will appear.
what i want to happen is, input my ID, click the button, get the name, place the name inside inside my name <input>
box and make the <div>
appear.