Change Css Class Property Dynamically Javascript Substring Until Character