getElementById() wildcard

In one of the comments you say:

(…) IE is anyway banned on my page, because he doesn’t get it with CSS. It’s an admin tool for developer, so only a few people, and they will anyway use FF

I think you should follow a different approach from the beginning, but for what it’s worth, in the newer browsers (ok, FF3.5), you can use document.querySelectorAll() with which you can get similar results like jQuery:

var elements = document.querySelectorAll('[id^=foo]');
// selects elements which IDs start with foo

Update: querySelectorAll() is only not supported in IE < 8 and FF 3.0.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)