I have 3 markup fields, i just want a basic logic that if these fields are left blank, then this <div id="category"> will not display.
[EDIT] Updated
<div id="panel">
<div id="form">
<div class="input-prepend">
<span class="add-on">name</span>
<input class="span3 required" id="prependedInput" type="text">
</div>
<div class="input-prepend">
<span class="add-on">last name</span>
<input class="span3 required" id="prependedInput" type="text" placeholder="Your Lastname">
</div>
<div class="input-prepend">
<span class="add-on">email</span>
<input class="span3 required" id="prependedInput" type="text" placeholder="Your Email">
</div>
</div> <!--/form-->
</div> <!--/panel-->
<!--DROPDOWN-->
<select id="category">
<option value="" disabled="disabled" selected="selected">Please select a category</option>
<option name="choice1" value="blue"> blue </option>
<option name="choice2" value="red"> red </option>
<option name="choice3" value="pink"> pink </option>
<option name="choice4" value="yellow"> yellow </option>
<option name="choice5" value="violet"> violet </option>
</select>
this is my jquery, and it doenst seem to work to me.
if ($j(".required").is(':empty')) {
$j("#category").hide();
} else {
$j('#category').show();
}
sj('#category').show();$j('#category').toggle($j('.required').val() === '')- Passing a boolean to.toggle()will show it fortrue, hide it forfalse.