Login
Remember
Register
PHPOnlineSupport
Questions
Unanswered
Tags
Categories
Ask a Question
Ask a Question
Find all parent elements with Jquery
0
votes
2.8k
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
8.1k
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
2.2k
views
How to add auto numbering column to a Jquery datatable?
asked
Dec 5, 2018
in
Jquery
by
mithun
(
740
points)
auto-numbering-column
jquery
datatable
+1
vote
1
answer
9.4k
views
jquery verify json string
asked
May 11, 2017
in
Jquery
by
Jasna
jquery
json
validate
0
votes
1
answer
7.6k
views
php find exact match in string?
asked
Mar 5, 2018
in
General
by
mithun
(
740
points)
compare
string
php
contains
+1
vote
1
answer
1.2k
views
Find products without categories
asked
Sep 5, 2016
in
Magento
by
Liam
magento
category
product
import
report
0
votes
1
answer
693
views
Strip the HTML from a string (extract only text content) in Javascript
asked
Jul 25, 2018
in
Jquery
by
Syam
strip
html
javascript
All categories
General
(38)
CMS
(21)
Frameworks
(20)
eCommerce
(58)
IOT - Internet Of Things
(4)
Javascript
(6)
Jquery
(6)
Databases
(1)
Categories
All categories
General
(38)
CMS
(21)
Frameworks
(20)
eCommerce
(58)
IOT - Internet Of Things
(4)
Javascript
(6)
Jquery
(6)
Databases
(1)
Most popular tags
magento
wordpress
php
wp
category
module
product
laravel
kohana
admin
url
cache
jquery
database
configurable
serial1
serial
encrypt
phalcon
truncate
fishpig
js
include
javascript
cms
backend
email
plugin
post
arduino
seo
security
migrate
editor
decrypt
python
iot
map
json
shipping
password
core
log
mage
pear
string
replace
extension
import
php7
error
function
form
order
google
image
youtube
customer
site-links
adblocker
qr-code
barcode
samsung
mac
popup
newsletter
feed
auto-numbering-column
datatable
admin-bar
adminbar
toolbar
mongodb
address16
address64
xbee
301
302
parents
execution-time
calculate
case-sensitive
contains
interface-class
abstract-class
ternary
ajax
cancel
oracle12c
xampp
isset
submit
extract
matrix
uno
mega
coupon
print_r
programatically
member
...