JQuery doesn't work well in my XQuery file, why?
<p>I have an XQuery file creating an HTML page with selects about dates and hours. Then when I click on the button, I want to try if the selected data is right or not (begin date can't be > than end date, and if begin and end dates are the same, check the hours).</p>

<p>The problem is that if I simply put an alert in my JQuery function after setting all the vars, it works well. But with that if-statement it doesn't print the alert no matter what I choose in the selects (good dates or not).</p>

<p>I have to precise that the vars are correctly got from the selects, when I try to get it from the alert without if statement it works.</p>

<pre><code>xquery version "1.0";

declare namespace request="http://exist-db.org/xquery/request";
declare namespace xs="http://www.w3.org/2001/XMLSchema";
declare namespace local = "http://www.w3.org/2005/xquery-local-functions";
declare option exist:serialize "method=xhtml media-type=text/html";

&lt;html&gt;
   &lt;head&gt;
      &lt;link rel="stylesheet" type="text/css" href="http://localhost:8088/myproject/style.css"/&gt;
      &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8"/&gt;
      &lt;title&gt;My HTML page&lt;/title&gt;
      &lt;script src="http://localhost:8088/myproject/jquery-1.8.3.min.js"&gt;&lt;/script&gt;
      &lt;script&gt;
      &lt;!--
      $(function(){
         $("#button").click(function(){
            var $begindate=null,$enddate=null,$beginhour=null,$endhour=null;
            $begindate = $("#dateBegin").prop("selectedIndex");
            $enddate = $("#dateEnd").prop("selectedIndex");
            $beginhour = $("#hourBegin").prop("selectedIndex");
            $endhour = $("#hourEnd").prop("selectedIndex");
            if(($begindate&gt;$enddate)||(($begindate==$enddate)&amp;&amp;($beginhour&gt;endhour))){alert('problem');}
         });
      });
      // --&gt;
      &lt;/script&gt;
   &lt;/head&gt;

   &lt;body&gt;
      ... Contains many selects whose ids are dateBegin, dateEnd, etc..
   &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>What is wrong? </p>
