jquery - get selected li from url -


I am trying to add the appropriate class in my selected li, with the selected HTML text retrieve url substrings. To give an example I have the following list

  & lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "" & gt; Trial & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "" & gt; Test 2 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "" & gt; Test 3 & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt;   

If I click on test2 , then a parameter may be passed and my URL will look like this as < Pre-> localhost / page / test2

and the second should be found after the selected category. I tried but it is not working

You have to check each link in UL against variables What you'll find 'find again:

  $ ("# tier_0"). ("A"). Each (function () {if ($ (this) .text (). Match (variables [1]) {$ (this). Parent (). AddClass ('selected');}});   

Here's a working child:

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 -