Add additional CSS to length dropdown select?

Add additional CSS to length dropdown select?

sbirniesbirnie Posts: 11Questions: 1Answers: 0

Sorry if this is a duplicate post - it's been a while since I posted a question and wasn't sure if mine all go into the Free Community support forum or if I can post to a specific forum.

Is there a way to add a custom CSS to the datatable length dropdown menu?

We have code that looks for changes on the page if someone tries to leave it, but we ignore fields with "ignore-changes" CSS. If someone changes the datatable length dropdown from 10 to 25 or whatever and tries to leave the page we're showing them a warning.

I'd like to add the ignore-changes css to that dropdown.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,971Questions: 1Answers: 10,160 Site admin
    Answer ✓

    Is there a way to add a custom CSS to the datatable length dropdown menu?

    Use $('div.dataTables_length select').addClass( ... ); once the table has been created (in initComplete if you are Ajax loading the data).

    Allan

This discussion has been closed.