Apply class to every div with certain id if the id ends with a even number using jquery
<p>I would like to apply a class to each div with a certain id if that id ends with a even number. Also i want to apply a different class to the ones that end with a odd number. Ideally it would be great if that can be achieved with jquery.</p>

<p>Here is a example. I want to add class "Red" to all divs with id "item1" where the final number is odd. So class "Red" will be applied to item1, item3, item5.</p>

<p>Similarly i want to add class "Green" to all divs with id "item2" where the final number is even. So class "Green" will be applied to item2, item4, item6.</p>

<p>Thanks, any help would be greatly appreciated!</p>
