Is there any way to take only part of string in jquery? -


I have some anchor links that start with ID "menu -" . & lt; A href = "" id = "menu-alphabet" & gt; & Lt; A href = "" id = "menu-city" & gt; & Lt; A href = "" id = "menu-country" & gt;

In my jquery code, I only want to take the menu after anchor link id -

  For example: $ ("A [id = = menu -]"). Click (function () {e.preventDefault (); $ (this) .tab ('show');});   

But $ (this) takes all the IDs I want only words that comes after menu - .

Use click (function () {e.preventDefault (); $ ( '#' +) This.id.split ('-') [1]) tab ('show');});

Apart from this, your HTML is not well prepared ..

    



Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -