Firstly hello everyone and apologies for breaking new ground in terms of simple idiot questions. Ok so I'm trouble doing something I would consider as simple with jquery. I have a form and i want to run a common function (that checks a bunch of inputs) that will be run when certain fields blur. working off the blur field is not a problem, but parsing the function is... example below. Looking at callback's in jQuery I'm still a bit confused and i cannot find anything floating around the net that does similar to what i want to do (common function invoked from multiple different fields).
function EvalFields() { var arrFieldNames = array; var boolFields = boolean; boolFields = true; alert("running"); // easy way to know if your running the code or not arrFieldNames[0] = "#frmField1"; arrFieldNames[1] = "#frmField2"; arrFieldNames[2] = "#frmField3"; arrFieldNames[3] = "#frmField4"; arrFieldNames[4] = "#frmField5"; for (var x=0;x>arrFieldNames.length;x++) { if( !$.(arrFieldNames[x]).empty() ){ boolFields = false; } } if (boolFields == true) { $.("#frmHiddenField").val("1"); } else { $.("#frmHiddenField").val("0"); } } ^^ this is the function I want to use. It just cycles through a bunch of fields and if they all have content it'll flick a switch for server side processing later on. $("#frmField1").blur(function () { EvalFields(); }); $("#frmField2").blur(function () { EvalFields(); }); $("#frmField3").blur(function () { EvalFields(); }); $("#frmField4").blur(function () { EvalFields(); }); $("#frmField5").blur(function () { EvalFields(); }); ^^ the on blur events should be fine right? I'm assuming that I'm not defining the function properly and/or passing jquery through(maybe i'm not event getting this far!)... The whole point of this was to not write the exact same code for the 5 odd, specific, blur events but i've wasted so much time on this i need to seek assistance. Can anyone help me with this? Thanks in advance. p.s. all form elements have appropriate id's set, etc. and I'm successfully using the Validation plugin already.