Sorry I am just really starting to get into javascript and I can’t nail down the syntax.
Here is my script:
jQuery(document).ready(function ($) {
$('div[align="right"][style="margin-right:15px;"]').each(function () {
$(this).removeAttr('align')
$(this).removeAttr('style');
$(this).addClass('homepagecontent2');
});
});
Basically I just want to find every div with align="right" and style="margin-right:15px;" and then remove the align and style and add the class.
It works fine when I just look for align="right" but when I add the second element into the equation it breaks.
It is better to filter elements by CSS style: