My control is built dynamically accordingly to user input, there are n
textboxes whose IDs are dynamic too.
However, I did not foresee that this HTML w
I do understand that "Id" should be unique, however, with the outest with different "id", can it help in solving the problem?
No. Having non-unique element ids will not work. Not consistently, in any case (different browsers and frameworks may handle this case differently).
Any experts out there can give me some good advises?
Prefer using class
over using id
, particularly for any component which may be reused multiple times on a page.
Set ids against the containing elements themselves instead of the internal component elements, and revise your jQuery selectors accordingly. Or alternately implement your component such that it takes a 'namespace' parameter/attribute when used, and prefix each classname with the namespace inside of your component (this approach works particularly well when creating custom JSP tags).
You can't have the same id
multiple times. Use class
instead.