On 15 Giu, 14:55, "Ariel Flesler" <[EMAIL PROTECTED]> wrote:
> var n = +"forum-list-1".slice(-1); ;-)
I think this won't work if the number has 2 or more digits.
The split('-').pop() way works better imho :)
var n = this.parentNode.parentNode.id ; // return: forum-list-x (x is
an integer).
I use this statement to extract the number:
var n = this.parentNode.parentNode.id.slice(11);
I think this is the good solution!!
On Jun 15, 6:56 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote:
> Aaargh, can somebody
Sorry, I need the number (marked with x):
forum-list-x
and not the string before the number.
On Jun 15, 3:55 pm, "Ariel Flesler" <[EMAIL PROTECTED]> wrote:
> var n = +"forum-list-1".slice(-1); ;-)
>
> --
> Ariel Fleslerhttp://flesler.blogspot.com
>
> On 6/15/08, Klaus Hartl <[EMAIL PROTECTED]
Aaargh, can somebody please stop Ariel ;-)
--Klaus
On 15 Jun., 14:55, "Ariel Flesler" <[EMAIL PROTECTED]> wrote:
> var n = +"forum-list-1".slice(-1); ;-)
>
> --
> Ariel Fleslerhttp://flesler.blogspot.com
>
> On 6/15/08, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > And in case you want
var n = +"forum-list-1".slice(-1); ;-)
--
Ariel Flesler
http://flesler.blogspot.com
On 6/15/08, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
>
> And in case you want to shorten the parseInt:
>
> var n = +"forum-list-1".split('-').pop();
>
> --Klaus
>
>
> On 15 Jun., 14:24, Klaus Hartl <[EMAIL PROT
And in case you want to shorten the parseInt:
var n = +"forum-list-1".split('-').pop();
--Klaus
On 15 Jun., 14:24, Klaus Hartl <[EMAIL PROTECTED]> wrote:
> var n = parseInt(/\d/.exec("forum-list-1")[0]);
>
> Or even easier using split (if you can rely on the format of the
> string) - pretty mu
var n = parseInt(/\d/.exec("forum-list-1")[0]);
Or even easier using split (if you can rely on the format of the
string) - pretty much what Ariel already showed:
var n = parseInt("forum-list-1".split('-').pop());
--Klaus
On 15 Jun., 13:18, yo2lux <[EMAIL PROTECTED]> wrote:
> Thanks and which
Thanks and which is the best way to obtain the last number of string,
for example I have:
forum-list-1
forum-list-2
forum-list-3
I need the numbers: 1, 2 or 3.
On Jun 12, 6:44 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote:
> And that's why Ariel is da man! Nice one.
>
> --Karl
>
> Ka
And that's why Ariel is da man! Nice one.
--Karl
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Jun 12, 2008, at 7:09 AM, Ariel Flesler wrote:
Ooor
var fileName = $('img').attr('src').split('/').pop();
Cheers :)
--
Ariel Flesler
http://flesler.blogspo
var path = $('img').attr('src').replace(/.*\//, '');
Actually, I like Ariel's solution better as it's more readable. I
just have a personal compulsion to solve every problem with regex.
On Jun 11, 4:36 pm, yo2lux <[EMAIL PROTECTED]> wrote:
> path variable store the following: /themes/mytheme/
Ooor
var fileName = $('img').attr('src').split('/').pop();
Cheers :)
--
Ariel Flesler
http://flesler.blogspot.com/
On 11 jun, 22:29, Karl Swedberg <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> You could do it like this:
>
> var path = $('img').attr('src');
> var fileName = path.slice(pat
Hi there,
You could do it like this:
var path = $('img').attr('src');
var fileName = path.slice(path.lastIndexOf('/')+1);
--Karl
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Jun 11, 2008, at 7:36 PM, yo2lux wrote:
path variable store the following: /themes
12 matches
Mail list logo