Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Need to override the keyup function with a home grown function

Posted on 2011-09-21
5
Medium Priority
?
373 Views
Last Modified: 2012-05-12
I have a jqGrid validation methodology that's killing performance, due to the fact that the validateDuplicates function is being injected into the keyup event. I want to use my own function which would only return true if a duplicate is found, and at that point a performance hickup is okay.

Can someone tel me how to make up my own function, and make it chainable?

Right now I have this:
$('[id^="Container_"]).keyup(validateDuplicates).change(validateDuplicates);

I need (at least I think I need) to write an alternative to keyup, call it displiatesFound. And in there I'd add each barcode to a list, after checking if it already existed. If it did exist, two duplicates are found.

Thanks!
0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36578152
why don't you simply unbind the keyup event and see what happens?
0
 

Author Comment

by:newbieweb
ID: 36578167
Not sure what you mean by unbinding...
0
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 2000 total points
ID: 36578176
$('[id^="Container_"]).unbind("keyup");
0
 

Author Comment

by:newbieweb
ID: 36578199
But then what action (or event) would call the jquery default error code?

Here's what I was going to do. Please tell me if this will work. Oddly, it seems to and I have not yet even created my own duplicates test. I planned to insert it inside the anonymous function I created.

$('[id^="Container_"]).keyup(function () {
     validateDuplicates()
}).change(validateDuplicates);

What do you think?
0
 

Author Closing Comment

by:newbieweb
ID: 36578249
I think my code unbinded it in a different way. Thanks.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

647 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question