I'm having a bit of an issue converting a piece of code into a function. My issue can be described here: http://www.phpfreaks.com/forums/index.php?topic=341166.0 The code I have used is also there. Basically, when the code is not in a function it works fine. As soon as I convert it into a function (as described by the members at PHPfreaks) it doesn't work. I am not sure what is going wrong. Any help will be nice thanks
looking at that thread, what nogray suggested should have worked assuming you have other helper functions all defined. why don't you post the complete code here or host it somewhere for us to debug.
I think you've messed this since you are using "this" parameter. Try this one: 1. Change function - use "elem" instead of "this".Change it in whole function function check_user(elem) { // .... change all "this" to "elem" } Code (markup): 2. Call the function with this code: $('#username').keyup(function () { check_user(this);}); Code (markup): You can also try to change the function name, maybe it is already declared. Let me know if it helped you.