On a page with 4 possible input values arriving from a previous page (page can be gotten to as a step 2 of a multistep form), im attempting to write jquery so that: IF field values arrive empty, OR no fields are there at all,do nothing, else
trigger a function. no problem with the else and function part but I don't know how to do the first part: write or define in Jquery "empty" (""
?) or "non-existant" (undefined
?), and not sure how to tell it "do nothing" ({}
?).
here is my best attempt:
$(document).ready(function(){
var val1Get = $("#val1Pass").val();
var val2Get = $("#val2Pass").val();
var val3Get = $("#val3Pass").val();
var val4Get = $("#val4Pass").val();
if(val1Get + val2Get + val3Get + val4Get) == (' "" || undefined ') {}
else {
$("#wrapper").prepend('<div id="mssg11"><div id="bnnr"><h3>Welcome</h3></div></div>');
});