changed to support older browsers (use JQuery to get attr selectors)