CORRECTION TO THE ABOVE CODE. the if statement needs to read: if($(a).attr('id').indexOf('div1') != -1)
On May 15, 10:41 am, motob <[EMAIL PROTECTED]> wrote: > I think this would be possible, but you would need to write a custom > selector expression. You can refer to this > link:http://www.malsup.com/jquery/expr/. > > You might be able to get away with something like this. > > jQuery.extend(jQuery.expr[':'], { > startsWithDiv1: function(a){ > //a = DOM element being tested > if($(a).attr('id').indexOf('div1') != 0) { > return true; > } > > return false; > } > > }); > > Then you could use the selector like this $(":startsWithDiv1"). > > The above code will test to see if the id attribute contains 'div1', > but you can use a regular expression in place of the indexOf. If the > function returns true, then the element is selected, if false, the > element is not selected. I've never actually created my own custom > selector, so maybe someone else can chime in too. > > Brian > > On May 15, 7:55 am, Orcun Avsar <[EMAIL PROTECTED]> wrote: > > > Is it possible to define a regex with a # selector that will allow > > select multible idies. > > For example i want to select tags with idies those start with "div1." > > or some idies with more complexed match that can be find through a > > regexp expression