I am having no luck with non-standard characters in class names, used
in a function

I am using this is a wonderful technique via Karl, that allows
children to inherit their parent td width.

$(document).ready(function() {
   var cellWidth = {
    searchUser: [80, 110, 145, 70, 100, 100, 236],
    searchAcct: [80, 130, 80, 80, 80, 190, 201],
    searchCntr: [75, 120, 86, 86, 86, 86, 110, 80],
    acct-his: [200, 303, 203],
   };

   $.each(cellWidth, function(key, val) {
     for (var i=0, cl= val.length; i<cl; i++) {
       $('.' + key + ' tbody td:nth-child(' + (i+1) + ')').width(val
[i])
         .children().css({overflow: 'hidden'}).width(val[i]);
     };
   });
});


My problem is with class names with non-standard characters (in my
case hyphens). Jquery doesn't recognize these. I tested the techniques
on: 
http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F

so in line 8 below, i tried things like:
acct\\-his
acct-[his]
$('.' + key.replace(/-/g,"\\-") + ' tbody td:nth-child(' + (i+1) +
')').width(val[i])


if any one can point me to other solutions, i would be very grateful.

Reply via email to