how to select the li element with specific link text
Using the following navigation I display an image gallery of products that start with the selected letter.
- <ul class="pagination pagination-lg" id="letterNavMenu">
- <li class="page-item active"><a class="page-link" onclick="">A</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('B')">B</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('C')">C</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('D')">D</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('E')">E</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('F')">F</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('G')">G</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('H')">H</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('I')">I</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('J')">J</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('K')">K</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('L')">L</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('M')">M</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('N')">N</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('O')">O</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('P')">P</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('Q')">Q</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('R')">R</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('S')">S</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('T')">T</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('U')">U</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('V')">V</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('W')">W</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('X')">X</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('Y')">Y</a></li>
- <li class="page-item"><a class="page-link" onclick="reloadData('Z')">Z</a></li>
- </ul>
The releoadData() removes the 'active' class from the <li> item and then makes an ajax call to get all the products that starts with that letter and displays thumbnails for each of them.
If the user had clicked on 'T' how do I use jquery to select the <li class="page-item"> element for T to run the function addClass('active') so T becomes highlighted?