0

I want to validate my textbox on keypress event. As I am newbie with jquery, I searched on google and found one jquery plugin named 'limitkeypress'.

This is my code:

$(document).ready(function() {
    $("#title").limitkeypress({ rexp: /^[A-Za-z]*$/ }); 
});

Plugin library is:

http://brianjaeger.com/process.php

It's giving me the following error

$("#title").limitkeypress is not a function

When I checked the library on jsfiddle it shows me dozens of errors. Is there any other validation library or plugin?

EDIT Thanks everyone for your valuable comment. Finally I got the solution. Though I was including file correctly. but don't know Y it was not working. I wrote jQuery.noConflict(); and all the problem is solved. What exactly it work. Please let me know, though I read but doubt still I have doubt.

3
  • Did you try their demo on a simple page to see if it worked or if it's just your application? Did you make sure their JS is included and downloaded properly in Firebug? Commented Oct 1, 2011 at 16:47
  • Yes I have download its one of version. didn't download min.js....Should I do that? And its working on site.. Commented Oct 1, 2011 at 16:59
  • If you're including some other library besides jQuery on your page such as ExtJS or prototype, some of the function calls may overlap. The noConflict() function namespaces the jQuery calls so that no accidental overloading will occur. Commented Oct 3, 2011 at 14:50

3 Answers 3

1

regexp is ok: 'buGaGa'.match(/^[A-Za-z]*$/);
$("#title").limitkeypress is not a function probably you forget to inlude library or wrong path.
Check it in Firebug( Net -> All ) lib must be highlight in black, not red.

Sign up to request clarification or add additional context in comments.

5 Comments

Nopes it doesn't shows me anytype of error using firebug.. Even this error is shown by firebug.. chrome shows me..#object has no method limitkeypress..
add <script type="text/javascript" src="http://brianjaeger.com/jquery.limitkeypress.js"></script> if error still exists, may be plugin is incompatible with your jquery version, on site of plugin using jquery 1.3.2
Problem still continue..Ya its written for jquery1.3.2 showing on site and now I am using. Jquery's latest version how can I make it compatible..?
Look at Andy's answer, there is no compatibility problem. I advise to you to remove all javascript except limitkeypress, may be error not in plugin.
I did, I don't know y its not working even I have included correct path.
0

Made a demo: http://jsfiddle.net/tTASy/ plugin seems to work fine.

Check your path to the script. if you paste a link to your page we could help you more specifically.

1 Comment

how can I show u that... join on onlinemeeting. I will show you that how it work..
0

You can do this in jQuery like this without the plugin..

$("#your_textbox").keypress(function() {
  var length = this.value.length;
  if(length >= MIN && length <= MAX) {
    $("#your_submit").removeAttr("disabled");
    $("#your_validation_div").hide();
  } else {
    $("#your_submit").attr("disabled", "disabled");
    $("#your_validation_div").show();
  }
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.