1

I am currently working on a project where class names are dynamically generated. I need to style these to override some richface component for the jsf framework.

I have a bunch of css classes that have this format:

rf-edt-hdr-c_idt12  
rf-edt-hdr-c_idt13    
rf-edt-hdr-c_idt14 

and so on and so forth.

It is nested pretty deeply in the html and I was wondering what would be the best way to handle this? There are some nasty nested divs inside tables and I need to over ride its behaviour as I have no access to the components the developers used to do up some cleaner html.

Would it be a good idea to use jQuery and if so what plugin would be best? I went down the css route using attribute value by selector by it's not behaving exactly how I want it to. (I think the nested tables and divs might have something to do with that).

It's driving me nuts.

1 Answer 1

2
  1. Yes, use jQuery
  2. Use the starts-with selector: http://api.jquery.com/attribute-starts-with-selector/. You can use $('div[class^="rf-edt-hdr-c_idt"]') to get your element.
Sign up to request clarification or add additional context in comments.

7 Comments

Note however that this will only work if the class is the first class on the element. A .filter() solution would be more flexible.
True, though I think this answer is also just a push in the right direction for him.
Start with this, and check if it works. If it doesn't, come back here, and we'll try to make a more complex solution.
I'm trying to strip all the numerical values after the idt part in the class name. I'm not a developer and am not good at all at the programming part of css
$('div[class^="rf-edt-hdr-c_idt"]').attr('class').substr("rf-edt-hdr-c_idt".length); should give the ID.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.