jquery not working in external js file
<p>this is the content of my external javascript code</p>

<pre><code> function EmailValidationX(semail) {
     var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
     return emailPattern.test(semail);
 }
 jQuery(function () {
     var nameDefault = 'Name';
     var emailDefault = 'Email Address';
     $('#btnNotify').css('cursor', 'pointer');
     $('#btnNotifyMe').css('cursor', 'pointer');
     $('#name').focus(function () {
         if (($(this).val() == nameDefault)) $(this).val('');
     });
     $('#name').blur(function () {
         if (($(this).val() == '')) $(this).val(nameDefault);
     });
     $('#email').focus(function () {
         if ((encodeURI($(this).val()) == encodeURI(emailDefault))) $(this).val('');
     });
     $('#email').blur(function () {
         if (($(this).val() == '')) $(this).val(emailDefault);
     });
     $("#tagetPrice").keydown(function (event) {
         if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 || (event.keyCode == 65 &amp;&amp; event.ctrlKey === true) || (event.keyCode &gt;= 35 &amp;&amp; event.keyCode &lt;= 39)) {
             return;
         } else {
             if (event.shiftKey || (event.keyCode &lt; 48 || event.keyCode &gt; 57) &amp;&amp; (event.keyCode &lt; 96 || event.keyCode &gt; 105)) {
                 event.preventDefault();
             }
         }
     });
     $('#btnNotify').click(function (e) {
         $('#red_notify_me').fadeIn('slow');
     });
     $('#red_notify_me_close').click(function (e) {
         $('#red_notify_me').fadeOut('slow');
     });
     var _url = '../notify.php?';
     function request(_url) {
         var request = $.ajax({
             url: _url,
             type: "POST",
             data: 'p=&lt;?php print $mainProduct["name"]; ?&gt;&amp;cn=dom&amp;ce=com&amp;pr=&lt;?php print $mainProduct["price"]; ?&gt;&amp;cat=&lt;?php print $mainProduct["category"]; ?&gt;',
             dataType: "html",
             success: function (html) {
                 $('#notifyMeContainer').html("Thanks For Submitting");
                 setTimeout('$(\'#red_notify_me_close\').click()', 3000);
                 return false;
             },
             fail: function () {
                 $('#notifyMeContainer').html('Data Connection Failed');
             },
             error: function () {
                 $('#notifyMeContainer').html('Network Connection Failed (404)');
             }
         });
     }
     $('#btnNotifyMe').click(function () {
         var _fName = $('#name').val();
         var _fEmail = $('#email').val();
         var _fTP = $('#tagetPrice').val();
         if (_fName == "" || _fName == "Name") {
             alert('Please enter your name');
             $('#name').focus();
             return false;
         }
         var j = 0;
         for (j = 0; j &lt; _fName.length; j++) {
             var c = _fName.charAt(j);
             if (c == '!' || c == '@' || c == '#' || c == '%' || c == '^' || c == '&amp;' || c == '*' || c == '(' || c == ')' || c == '-' || c == '_' || c == '+' || c == '=' || c == '|' || c == '/' || c == '.' || c == '?' || c == '&gt;' || c == '&lt;' || c == ',' || c == '\\') {
                 alert("No special characters are allowed for Name");
                 $('#name').focus();
                 return false;
             }
             if ((c &gt;= '0' &amp;&amp; c &lt;= '9')) {
                 alert("Name cannot be Numeric");
                 $('#name').focus();
                 return false;
             }
         }
         if (_fTP == "" || _fTP == "Price") {
             alert('Please enter your target price');
             $('#tagetPrice').focus();
             return false;
         }
         if (_fTP &gt;= &lt;? php print $mainProduct["price"]; ?&gt; ) {
             alert('Target price should below the current best price.');
             $('#tagetPrice').focus();
             return false;
         }
         if (_fEmail == "" || EmailValidationX(_fEmail) == false) {
             alert('Please enter valid email-Id');
             $('#email').focus();
             return false;
         } else request(_url + '&amp;cn=' + _fName + '&amp;ce=' + _fEmail + '&amp;tp=' + _fTP);
     });
     var _subu = '../subscribe.php?';
     function srequest(_subu, _semail) {
         var request = $.ajax({
             url: _subu,
             type: "POST",
             data: {
                 su: _semail
             },
             dataType: "html",
             success: function (html) {
                 alert(html);
                 return false;
             },
             fail: function () {
                 alert("Failed");
             },
             error: function () {
                 alert("Error");
             }
         });
     }
     $('#subscribe').click(function () {
         var _semail = $('#semail').val();
         if (_semail == "" || EmailValidationX(_semail) == false) {
             alert('Please enter valid email-Id');
             $('#semail').focus();
             return false;
         } else {
             srequest(_subu, _semail);
         }
     });
     $("#reviwe").click(function () {
         if ($("#ui-id-3").parent().attr("aria-selected") == "true") {
             $("html, body").animate({
                 scrollTop: $("#respond").offset().top - 25
             }, 600)
         } else {
             setTimeout("$('#ui-id-3').click()");
             setTimeout("$('#reviwe').click()", 100)
         }
     });
     var CReCo = "";
     $("input:radio[name=comments_recommend]").click(function () {
         CReCo = $(this).val();
     });
     var _rurl = 'submitratings.php?';
     function reviewc(_rurl) {
         var reviewc = $.ajax({
             url: _rurl,
             type: "POST",
             data: 'q=&lt;?php print $mainProduct["name"]; ?&gt;&amp;submit=submitted',
             dataType: "html",
             success: function (html) {
                 $('.ratings').html('Your Review Have Been Submited Successfuly.')
             },
             fail: function () {
                 $('.ratings').html('Data Connection Failed');
             },
             error: function () {
                 $('.ratings').html('Network Connection Failed (404)');
             }
         });
     }
     $('#comm_submit').click(function () {
         var CTitle = $('#title').val();
         var CRates = $('#my_input').val();
         var CComm = $('#comments_comments').val();
         var CName = $('#comments_name').val();
         var CEmail = $('#comments_email').val();
         if (CTitle.length &gt; 100 || CTitle.length &lt; 10) {
             alert('Title must be between 10 to 100 characters.');
             $('#title').focus();
             return false;
         }
         if (CRates == "") {
             alert('Please Rate this product.');
             $('#rate').focus();
             return false;
         }
         if (CComm.length &gt; 2500 || CComm.length &lt; 20) {
             alert('Comment should be between 20 to 2500 characters.');
             $('#comments_comments').focus();
             return false;
         }
         if (CReCo == '') {
             alert('Please Tell us will you recommend this product to others.');
             $('#comments_recommend').focus();
             return false;
         }
         if (CName == "" || CName == "Name") {
             alert('Please enter your name');
             $('#comments_name').focus();
             return false;
         }
         var j = 0;
         for (j = 0; j &lt; CName.length; j++) {
             var c = CName.charAt(j);
             if (c == '!' || c == '@' || c == '#' || c == '%' || c == '^' || c == '&amp;' || c == '*' || c == '(' || c == ')' || c == '-' || c == '_' || c == '+' || c == '=' || c == '|' || c == '/' || c == '.' || c == '?' || c == '&gt;' || c == '&lt;' || c == ',' || c == '\\') {
                 alert("No special characters are allowed for Name");
                 $('#comments_name').focus();
                 return false;
             }
             if ((c &gt;= '0' &amp;&amp; c &lt;= '9')) {
                 alert("Name cannot be Numeric");
                 $('#comments_name').focus();
                 return false;
             }
         }
         if (CEmail == "" || EmailValidationX(CEmail) == false) {
             alert('Please enter valid email-Id');
             $('#comments_email').focus();
             return false;
         } else {
             reviewc(_rurl + 'rating=' + CRates + '&amp;comments_title=' + CTitle + '&amp;comments_comm=' + CComm + '&amp;comments_recommend=' + CReCo + '&amp;comments_name=' + CName + '&amp;comments_email=' + CEmail);
         }
     });
 });
</code></pre>

<p>the above code not working</p>

<p>and when i call  like this it works fine</p>

<pre><code>&lt;script type="javascript/text"&gt;code&lt;/script&gt;
</code></pre>

<p>i dont know what is wrong there</p>
