• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Help with JavaScript and RegEx

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a hierarchical list:

I want to write some Javascript which takes an id and cascades up the list.

For example:

If 7.2.2 is selected the javascript needs to take the string '7.2.2' remove the last '.xx' and set the tickbox (7.2) to true.

It then takes '7.2' removes the same pattern and sets the tickbox (7) to true.

It needs to continue doing this until there are no more strings that match '.xx'

I have the recursive function i'm just not so good on the regEx or subString parts.

Any ideas?

Thanks,

Liam
[originally posted on jforum.net by liam]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not to worry have sorted this, brain not working properly as its monday morning

:P

thanks anyway,

Liam
[originally posted on jforum.net by liam]
 
eat bricks! HA! And here's another one! And a tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic