Reduce multiple if else statements
<pre><code>My Name:&lt;input class="clr" id="name" type="text" /&gt;&lt;span class="clr" id="name_error"&gt;Name is required&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;

My Email Adress:&lt;input class="clr" id="email" type="text" /&gt;&lt;span class="clr" id="email_error"&gt;Email is required&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;

My Organisation Name:&lt;input class="clr" id="organisation" type="text" /&gt;&lt;span class="clr" id="org_error"&gt;Organisation is required&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;
</code></pre>

<p>I have 3 input fields. I'm using <code>span</code> to display error message when submitting empty fields.</p>

<p>My problem is, if <code>name</code> field is empty, we should get <code>"Name is required"</code> error, if <code>email</code> field is empty, we should get <code>"email is required"</code> error and so on.</p>

<p>For this, I'm writing below code.</p>

<pre><code>if (name == "")
    $("#name_error").show();
else
    $("#name_error").hide();

if (email == "")
    $("#email_error").show();
else
    $("#email_error").hide();

if (organisation == "")
    $("#org_error").show();
else
    $("#org_error").hide();
</code></pre>

<p>Is there any way to reduce if/else statements?</p>
