Union between two jquery selectors

This is my case:

var elems = form.find(':input');
var clEditors = form.find('.cleditor').parent();

elems.css('border', '2px');
clEditors.css('border', '2px');

Is there anyway I could prevent the duplication and do something like this:

var elems = form.find(':input').union(form.find('.cleditor').parent());
elems.css('border', '2px');

I tried using a multi selector with the :parent selector and it didn’t work:

var elems = form.find(':input, .cleditor:parent'); 


Source: jquery

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.