make sure that id string is valid

jQuery seems to have some problems with ids containing characters
like '[', which are common in names generated by rails