Login
Remember
Register
PHPOnlineSupport
Questions
Unanswered
Tags
Categories
Ask a Question
Ask a Question
Find all parent elements with Jquery
0
votes
4.0k
views
asked
Jul 25, 2018
in
Jquery
by
Sid
Find all parent elements (in my case its all parent "<li>" elements) with Jquery. Idea is to set active classes for my dropdown menu.
Can I do this with "parents" Jquery filter?
parents
jquery
Your comment on this question:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or
register
.
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or
register
.
1
Answer
0
votes
answered
Jul 25, 2018
by
anonymous
Supply $(this) to the code below and you are good to go. Change the css code to your requirements as well.
$(this).parents('li').add(this).each(function()
{
$(this).css({"color": "red", "border": "2px solid red"});
});
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or
register
.
Related questions
0
votes
1
answer
17.0k
views
Find all active links on a page with JS (not hashed '#')
asked
Jul 25, 2018
in
Jquery
by
Jennifer
hashed
links
jquery
js
+1
vote
1
answer
3.8k
views
How to add auto numbering column to a Jquery datatable?
asked
Dec 5, 2018
in
Jquery
by
mithun
(
1.3k
points)
auto-numbering-column
jquery
datatable
+1
vote
1
answer
10.3k
views
jquery verify json string
asked
May 11, 2017
in
Jquery
by
Jasna
jquery
json
validate
0
votes
1
answer
1.6k
views
DataTables help unknown parameter for row
asked
Jan 26, 2022
in
General
by
Sanal
datatables
jquery
0
votes
1
answer
985
views
Find difference between two dates
asked
Jan 26, 2022
in
Jquery
by
Singer
library
date
0
votes
1
answer
8.9k
views
php find exact match in string?
asked
Mar 5, 2018
in
General
by
mithun
(
1.3k
points)
compare
string
php
contains
All categories
General
(56)
CMS
(21)
Frameworks
(21)
eCommerce
(58)
IOT - Internet Of Things
(10)
Javascript
(10)
Jquery
(7)
Databases
(5)
Categories
All categories
General
(56)
CMS
(21)
Frameworks
(21)
eCommerce
(58)
IOT - Internet Of Things
(10)
Javascript
(10)
Jquery
(7)
Databases
(5)
Most popular tags
magento
php
wordpress
wp
laravel
category
database
module
product
arduino
kohana
js
jquery
admin
date
url
sing
birds
json
javascript
cms
cache
error
configurable
love
mac
xbee
serial1
serial
seo
encrypt
recaptha
phalcon
truncate
fishpig
include
backend
function
email
plugin
post
arduinojson
popup
mongodb
security
migrate
editor
decrypt
python
iot
map
shipping
password
core
log
mage
pear
string
replace
extension
import
php7
form
order
day
google
image
youtube
https
http
customer
syntaxerror
datatables
nested
x-ctu
xctu
pan-id
mesh
coordinator
esp
baud
esp8266
esp32
path-issue
site-links
adblocker
qr-code
barcode
samsung
newsletter
feed
auto-numbering-column
datatable
admin-bar
adminbar
toolbar
address16
address64
301
302
...