skip to Main Content

JQuery multiple indexof on Windows location Href

So I have this code that adds a class to my section whenever there's a url slug detected or contains that url. <script type="text/javascript"> jQuery(document).ready(function() { if (window.location.href.indexOf('product') > -1 || window.location.href.indexOf('about') > -1 || window.location.href.indexOf('careers') > -1 || window.location.href.indexOf('pricing')…

VIEW QUESTION

Jquery navigation bar style depending on current page

I have a pure HTML/CSS navigation bar in 4 pages, like this: <nav id="bar"> <ul id="nav"> <li><a href="aa.html">AA</a></li> <li><a href="bb.html">BB</a></li> <li id="page">CC</li> <li><a href="dd.html">DD</a></li> </ul> </nav> I can get the page name using javascript, with var pagename = window.location.pathname.split('/').pop(); I…

VIEW QUESTION

How to find first tr with ID that does not have a matching attribute via jQuery

I've been trying to solve this but no luck so far. I have the following HTML... <table id="datatable"> <tbody id="datarows"> <tr id="row1" class="datarow" style="display: table-row;">...</tr> <tr></tr> <tr id="row2" class="datarow" style="display: table-row;">...</tr> <tr></tr> <tr id="row3" class="datarow" style="display: table-row;">...</tr> <tr></tr> <tr id="row4"…

VIEW QUESTION
Back To Top
Search