JQuery selector for li whose first child is a span

here is an HTML structure I can't change: I successfully attached a click event handler for those li's, like so: $(document).on("click", "#menu li.top-level", function (e) { // whatever code }); However, I don't want the clicks on li's

How can I rotate an item?

Here is my code: $('.click').on('click', function(){ $(this).next('div').toggle(100); }); .click{ cursor: pointer; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link href="https:/

Get the parent class and fire in jquery

I want to trigger an event of the parent class by clicking a button or image. <li class="addImage"> <input class="PhotoPicker" type="file" accept="image/*" capture="camera" onchange="angular.

Delete empty & lt; pg, but allow only one per group

I was wondering how to remove empty elements, but allow only one empty element per group (next to non-empty one) ? Something like : Example HTML : <p>Hello world</p> <p><br></p> <p><br></p> <!--This will

JQuery how to select the parent but not the children

Sorry for what is probably an easy question, but I haven't found a way to make this work yet. I'm new to JQuery and I've got some nested lists which I'm trying to add a click event to a parent list which will slideToggle the children lists, which I'v

Exclude items having a parent with a particular class

I do have a script which selects all the tags under a particular element, it also exclude script tags. So right now its as follows. $(myElement).find("*:not(script)").each(function(){ But I need to exclude an element and its children. I am not s

Jquery non-selector is ignored with svg

Trying to change the color on all the paths in an svg group except one path that has been given the class "static". I have tried both of the following: $('.groupClass').children().not('.static').css('fill', '#FF0') In this case, the not selector

Using jQuery's bottom-up selector approach

I am curious based on jQuery's Bottom up or Right to Left query selecting. How could this selector below be improved? Not the actual keydown event but the .undo and .save portion of the code? <div id="dnsTitle" class="account accountTitl

Can anyone help me shorten this absurdly long selector?

EDIT: Skip to end for a better explanation of what I'm after, thx I have approximately the following html (this just an excerpt) where there is a nested organisation of chapters: <span class="chapter Art" id="00034"> <li>&l

how to get HTML value from jquery or javascript

I want to select the following three values from the HTML file either by Jquery or Javascript. class "class1" href value class "class1" inner text value (PersonA in the example code) class "Title" inner text value (Accountant

If declaration with two jQuery selectors

I'm trying to get an alert to appear if two conditions are met: The value of the display property on the #playerbox element is block, AND The value of the display property on the #playerinfo element is none I have this: if ($("#playerbox").css(&

How to get a reference to the jQuery selector return list?

I have some jQuery function: rfx.jQuery(function(){ rfx.jQuery(".form-row.errors").blur(some_function(this)) }); But 'this' is HTMLDocument and not a list of selector return values. How can I get reference to list of elements?The result of the s

jQuery select with partial name

I'd like the count the element on the page with the name : MyElement_1 MyElement_2 Then I'd like get element MyElement Thanks, var elements = $('[name^=MyElement]'); var length = elements.length; If you want some more advanced filtering, you can filt

How do you use the [attribute = value] selector?

var prev = b - 1; var previousImage = $('.header ul.active').find($('li[rel=prev]')); The 1st variable is an integer being deducted by 1. The next variable named previousImage is what i'm having trouble with. Each one of the lis within the previousIm

Jquery multiple selector with common tag name

Is there a way by which you can use multiple selectors with common tag name. So like, here i have $('span.clone1, span.clone2, span.clone3') i just want to make it common. ThanksHere's one way: var myclasses = [ '.clone1', '.clone2', '.clone3', '.som

selection using the nth child selector jquery

I want to make a selection in jquery using nth child selector I have the index number as a variable suggestions; but $('.search_filter:nth-child('+suggestions+')').focus(); does not focus the 2 element if suggestions=1 so please tell me what I am doi

select ul elements by number of children li

hallo all. i am trieng to build a function that gets all ul's on screen that have less then 3 li elements. i need this as a jquery object. so i dont mind if it will be a function or just one selector. how do i do it? thanksYou can use .filter() for t