I have some anchor links which has id’s starts with "menu-".
<a href="" id="menu-alphabetic">
<a href="" id="menu-city">
<a href="" id="menu-country">
In my jquery code, I want to take only anchor links’ ids after menu-
For example:
$("a[id^=menu-]").click(function(){
e.preventDefault();
$(this).tab('show');
});
But $(this) takes all id. I want only word which comes after menu-.
Use
.split()Also your HTML is not well Formed..
Check Fiddle