I do not understand your issue, why not call the global header search
something like "#header_search" and call it a day?


On Oct 26, 10:48 pm, André Hänsel <an...@webkr.de> wrote:
> Hi,
>
> I am wondering how one should mark elements to find them later, for
> example to attach event handlers to them. It is clear, that "id"
> certainly IS a way to do it, but having to use unique ids is quite
> uncomfortable, because it requires setting up some kind of "id
> namespace plan".
>
> As a common example, imagine there is a global search functionality in
> the header of every page. If I call it "#search" I get a problem when
> I later add a local search form on one of the pages.
>
> So how do you handle this? Just go ahead and set up an id plan? Using
> class, so both search fields have the class "search" and I address
> them using $("#header input.search") and $("#content input.search")?
> Or, because the aforementioned method mixes CSS-required classes with
> JS-required classes, use another attribute, possibly "name"?
>
> Regards,
> André

Reply via email to