Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Please give me right answer. i have been trying to find out a error for three hours

my code is
C#
function validate() {


       var strError = "";
       $(".error_message").hide();

       if (jquery.trim($("TextBox1").val()) == "")
           strError += "<p>Check properly</p>";


       if (strError.length > 0) {
           $(".error_message").attr(strError);
           $(".error_message").show();
       }
       else {
           alert("OK")
       }
       return false;

   }



and i am talking html controls .but one Error which is "Microsoft JScript runtime error:'jquery' is undefined" is coming and really it is eating my brain . please help me !!!!!

these Query Files are on the page
XML
<script src="../Script/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="../Script/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
Posted
Comments
Ed Nutting 15-May-12 15:54pm    
Erm...can we see the whole page? Remember the links to jQuery will need to come in the head section and before any other code runs such as your validation code. Also check the capitalisation of the word jQuery in your code - you have used a lower case "q" but I thought it required upper case (JavaScript is case sensitive as I'm sure you're aware.)

Hope this helps,
Ed

Please see my comment above then read this answer:


Just looked it up and I am now certain the jQuery needs a capital "Q" - see your first if block - the jquery needs to be written jQuery.

Hope this solves it,
Ed
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 15-May-12 18:12pm    
Right, a 5. Using '$' is a good idea, please see Solution 2.
--SA
Instead of using the word jquery use $. jquery is not anything in your code. Depending on the rest of your code you might also be able to use jQuery instead.

JavaScript
if ($.trim($("TextBox1").val()) == "")
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 15-May-12 18:11pm    
Right, a 5.
--SA
Hi,
I had a problem with the following code line .. while debug the code it gives an error like " 'trim' is undefined"...

Can any one please help me to resolve this error ?
C#
trim(document.getElementById("MainContent_ApplicationForm1_txtName").value) == ""
 
Share this answer
 
v2
Comments
[no name] 25-Jul-12 11:53am    
This is not an answer to this question. Hijacking someone else's question to ask your own question that is not even related is so not cool.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900