Ah!. That makes sense. Thanks for all of your help.
Bob On Mon, Jul 13, 2009 at 8:28 AM, Charlie <[email protected]> wrote: > I see why. I had a typo, missing a dot in > $('highlight').removeClass('highlight'); > > should have been $('**dot****highlight').removeClass('highlight'); > > Bob Gibilaro wrote: > > Charlie, > > Thanks for the help! I am new to jQuery and so I am not quite comfortable > with optimizing my selects. > > Using the code you provided, for some reason, I had an issue where it would > not un-highlight the row after it lost focus. So, I made a slight change and > the code below appears to work perfectly: > > $(function() { > $('input').add('textarea') > .bind('focus',function(event) { > $("[class*=highlight]").removeClass('highlight'); > $(this).parents(".form_row").addClass('highlight'); > }); > }); > > Thank you for your help. It is greatly appreciated. > > Bob Gibilaro > > On Fri, Jul 10, 2009 at 6:46 PM, Charlie <[email protected]> wrote: > >> Function is working, although it is very unorthodox way to get to where >> you are going. Look in Firebug, class highlight is being added and removed. >> div's are just collapsed >> >> Add *float: left* to css for class form_row, highlight works fine in >> Firebug >> >> As for function. Could simplify the whole thing a lot by better selector >> choice. You have a class for all the inputs you need to focus on, using >> that for your selector makes it all a lot more readable, and should there be >> a lot of inputs on page, more search efficient. Chaining is great but in >> your case seems to go to an extreme in order to make a very round about >> route >> >> try this and see how it works out, it's certainly a lot easier to read, >> therefore troubleshoot >> >> $(".inputTxt").focus(function() {// instead of starting at parent div, go >> straight to the input class already assigned , using $('div") on most pages >> will cause more searching than necessary >> $('highlight').removeClass('highlight');// this one very simple, if no >> class "highlight" exists, will be ignored, will work after first focus when >> next input focused on however >> $(this).parents(".form_row").addClass('highlight'); //reduces need >> for parents then filter, just target the parent you want in brackets >> }); >> >> >> >> intrader wrote: >> >> Just a disgusted-at-Microsft answer. >> Most likely I would suspect Microsoft (even when it 'works'). Break >> the expression into two - this is not jQuery like, but it may help. >> Good luck >> >> On Jul 9, 1:12 pm, bgibilaro <[email protected]> >> <[email protected]> wrote: >> >> >> All, >> >> I have created a very simply jQuery script which implements a new CSS class >> that changes the background color of the containing DIV of a text field when >> focused on. It works great in IE, however, for some reason it does nothing >> in Firefox. I am not getting an error of any sort. It just does not work. >> >> To see an example, go tohttp://www.kcsysadmin.com/nominate.phpand focus on >> one of the form fields and tab through. If you do this from both IE and >> Firefox you should see the difference. >> >> Here is my code: >> http://www.nabble.com/file/p24393078/jquery_script.jpg >> >> Any thoughts? Thanks for your help. >> >> Bob Gibilaro >> >> -- >> View this message in >> context:http://www.nabble.com/jQuery-Script-Not-Working-In-Firefox-tp24393078... >> Sent from the jQuery UI Discussion mailing list archive at Nabble.com. >> >> >> >> >> >> > > > -- > Bob Gibilaro, MCDBA, MCAD > Crazy Mutt Design > Web Design, Graphic Design > and Online Marketing > 615-419-7947 > > > > > > > -- Bob Gibilaro, MCDBA, MCAD Crazy Mutt Design Web Design, Graphic Design and Online Marketing 615-419-7947 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---
