$('#form').find('input').focus(function(){
var a = $(this).attr(id);
$(a+'Help').addClass('elementHelp');
});
I am trying to make a short code to target all the input elements inside a specific form. Whenever any input element is in focus, get it's id and change the font color of another element(if it exists) whose id is the concatenation of the input element's id followed by the word "Help".
I could make a function for this but I don't want the HTML guy to call it. I just want that he includes the script and it works. I have explained him the naming convention.
All that said the above code does not work. Can anyone please help me solve this.
Thanks a lot.
Also tell me if I am horribly wrong in doing it this way, even though I have been ordered to do so.