Regardless of whether things "work" or not, your use of ids is a poor practice. If ids need to change to accommodate your design, the design is flawed.
I suspect -- but don't have enough info from the original post -- that using ids at all is the wrong approach.
You should probably be exploring other ways to select the items rather than ids, which tend to be overused in situations where other selection hooks would be more appropriate.