Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31082

filter queryselectorall

Newsgroups comp.lang.javascript
From Andrew Poulos <ap_prog@hotmail.com>
Subject filter queryselectorall
Date 2016-08-06 14:25 +1000
Message-ID <b-Cdnanqh8Yn-zjKnZ2dnUU7-RnNnZ2d@westnet.com.au> (permalink)

Show all headers | View raw


I have a number of DIV elements many of which start with the ID 
"clickable_" and end with either an integer or some alphabetic characters.

I need to only select those that end with an integer. I can get the ones 
that start with "clickable_" using

var clickables = document.querySelectorAll('[id^="clickable_"]');

but when I try to filter it further I get stuck.

var clickables = document.querySelectorAll('[id^="clickable_"]').filter(
   function() {
     return this.id.match(/_\d*$/);
});

gives me ...filter is not a function.

How can I get just the elements whose ID that starts with "clickable_" 
and ends with an integer?

Andrew Poulos

Back to comp.lang.javascript | Previous | NextNext in thread | Find similar | Unroll thread


Thread

filter queryselectorall Andrew Poulos <ap_prog@hotmail.com> - 2016-08-06 14:25 +1000
  Re: filter queryselectorall "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-05 22:23 -0700
    Re: filter queryselectorall Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-06 08:16 +0200
      Re: filter queryselectorall "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-06 15:49 -0700
        Re: filter queryselectorall Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-07 07:08 +0200
          Re: filter queryselectorall Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2016-08-07 07:17 +0200
            Re: filter queryselectorall Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-07 07:58 +0200
          Re: filter queryselectorall "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-07 10:30 -0700
            Re: filter queryselectorall Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-07 21:16 +0200
              Re: filter queryselectorall "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-09 21:18 -0700
                Re: filter queryselectorall Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-15 22:02 +0200
                Re: filter queryselectorall "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-08-15 23:16 -0700
  Re: filter queryselectorall "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-08-06 10:28 +0200

csiph-web