I ran into an unusual situation yesterday night.
I need to match only part of id. Let me clear you all with an example
I have few divs like
You can use css selector
try this code
html
css
.red{
display:block;
float:left;
width:50px;
height:20px;
background-color:#FF0000;}
.blue{
display:block;
float:left;
width:50px;
height:20px;
background-color:#0000FF;}
jquery
$('div[id^="sales"]').addClass('red');
$('div[id^="user"]').addClass('blue');
css selector ^=
will select div with ID that start with the specified value and add the css style.