Using $("[class^=main]") will select all elements whose classname starts with ‘main’. Take a look at jQuery docs about selectors, there are a lot of other variations you can use, for example:
[class*=main]will select elements whose classname contains ‘main’[class~=main]will select elements whose classname has the word ‘main’ (delimited with spaces)[class$=main]will select elements whose classname ends in ‘main’