Javascript alert based on specific selected inputs (drop down lists)
<p>I have very limited Javascript knowledge so require some help please:</p>

<p>I have the following function:</p>

<pre><code>$('#addDialog').dialog({
        autoOpen: false,
        width: 500,
        buttons: {
            "Add": function() {

                //alert("sent:" + addStartDate.format("dd-MM-yyyy hh:mm:ss tt") + "==" + addStartDate.toLocaleString());
                var eventToAdd = {
                  //title: $("#addEventName").val(),
                    title: $("#addEventSalesPerson option:selected").text(),
                    description: $("#addEventDesc").val(),
                    start: addStartDate.format("dd-MM-yyyy hh:mm:ss tt"),
                    end: addEndDate.format("dd-MM-yyyy hh:mm:ss tt"),
                    salesperson: $("#addEventSalesPerson option:selected").text(),
                    eventPostCode: $("input[id$=addEventPostCode]").val(),
                    eventname: $("#addEventEventName option:selected").text()
                };

                if ($("input[id$=addEventPostCode]").val().length &lt; 5) {
                    alert("Post code cannot be blank and must contain a minimum of 5 characters");

                }

                else {
                    //alert("sending " + eventToAdd.title);

                    PageMethods.addEvent(eventToAdd, addSuccess);
                    $(this).dialog("close");
                }

            }

        }
    });
</code></pre>

<p><code>#addEventEventName</code> is a DDL populated from SQL and has several options. Currently, if the <code>"input[id$=addEventPostCode]"</code> has less than 5 characters then it gives an Alert.</p>

<p>What I need is, If the Selected Option is <em>Holiday</em> or <em>Sickness</em> then it does not display an alert. Thanks</p>

<p><strong>Update</strong>
I tried adding the following line as per @David's suggestion but still no joy - any takers?</p>

<pre><code>if ($("input[id$=addEventPostCode]").val().length &lt; 5 &amp;&amp; !($("#addEventSalesPerson option:selected").text() == "Holiday" || $("#addEventSalesPerson option:selected").text() == "Sickness")) {
</code></pre>
