Quick question. I want to make a variable from just a section(substring?) of an id in javascript / or jquery. I've got four possible id names: link_north, link_south, link_east, link_west.
I want to pull just the direction from the link to use as a variable, with this:
var header_change = $('.link_selected').attr('id');
How can I get rid of the 'link_' part?
I know it might be easier to just change the id names, but that's not what is wanted.
I got this far, but I don't know how to get just the second item?
var header_change = $(".link_selected").attr("id");
var n=header_change.split("_");
alert(n);