Remove char variable first with jQuery

I am trying to change a jQuery variable for example. /images/tree.jpg images / tree.jpg (without the first slash, so this should be a relative path instead of an absolute one).

I get the url like this: var href = jQuery ("img.thumbnail"). attr ("href");

Now I need this URL elsewhere, but without the first char.

Is there an easy way to do this? Thank!!

+5
source share
2 answers
var href = jQuery('img.thumbnail').attr('href');  // e.g.  '#foo'
var secondCharacterAndOnward = href.substring(1); // e.g.  'foo'

String.substring

Although I'm not sure why the image tag has an attribute href, to be honest ...

+24
source

javascript.

var href = jQuery("img.Thumbnail").attr("href");
    href = href.substring(1);
+6

All Articles