var id = "ctl03_Tabs1"; var lastFive = id.substr(id.length - 5); // => "Tabs1" var lastChar = id.substr(id.length - 1); // => "1"