JQuery :: Selecting Nested Elements?

Aug 17, 2011

i'm trying to do the following: select the links one after another and add a class to them. When the next one is selected i want to remove the class from the previous.

[Code]...

View 4 Replies


ADVERTISEMENT

JQuery :: Nested UL - Selecting Children One At A Time

Aug 9, 2011

So I'm new to jquery and I'm trying to spice up a navigation menu in my cms. I'm having trouble selecting children in a nested UL. Its just an add class on hover. But as you can see, it's selecting all of the children on hover. [URL]. I'm trying to find a solution that allows each listed link to be highlighted on hover, regardless of its place.

View 4 Replies View Related

JQuery :: Click Event On Nested Elements With Same Class?

Mar 1, 2011

I am making a system whereby if an element has a class "editable", you can click it and a popup box appears with some options about that particular element. Fairly straightforward, I'm using [code]...

This works fine but I need to be able to have lots of different divs, all with class "editable", some of which are inside others with class "editable". Like this [code]...

However, clicking on the 'somethingelse' div, triggers the click correctly but also triggers it for the parent 'something' div, so I end up with the popup box appearing twice.

Does anyone know how to just catch a click event on the exact div (without using ids) without triggering the parent?

View 1 Replies View Related

JQuery :: Click On And Highlight Nested Elements Independently?

Jul 22, 2011

I want to find a way to highlight elements when I click on them. The problem is the elements are nested and when I click on a child element, the parent element is highlighted as well. I would like the child to highlight only, but because the child is within the boundaries of the parent (i.e. you can't hover over the child without also hovering over the parent), the parent highlights as well.

For example, if you have...

<div>
<h1></h1>
<ul>
<li></li>
<li></li>
</ul>
</div>

I'd like to be able to hover over, click and highlight an <li> and hover over, click and highlight the <div> independently of one another. It's no problem to hover over, click and highlight the <div> without highlighting the <li>, but because the <div> encapsulates the <li> it's impossible to hover over, click and highlight the <li> without highlighting the <div>.

View 1 Replies View Related

JQuery :: Targeting Specific Nested Elements Of $(this) Efficiently?

Nov 24, 2010

My HTML:

<div class="home-button">
<span><a href="#" style="">Button</a></span>
</div>

I have an instance of a div (button), inside this div is a link wrapped in a span. When you hover over the div (".home-button")I want to move the background position inside its "span a", I've achieved this using the code below.

[Code]...

View 1 Replies View Related

JQuery :: Selecting All Td Elements In A Row But The First One

Feb 18, 2011

I have the following code that works fine (except the show/hide animation for the rows is proving to be a pain to get working):

In the table this is for, I have a checkbox in the first cell in the row the user hovers and clicks on to expand the following row. I am trying to make it so that clicking the checkbox doesn't trigger the jQuery toggling action.

Here is a sample row in the table this is for. The complete row below is what the user clicks on, and the row after that (class="docClassesRow") is what is expanded on clicking the above row

I tried adding :not(:first-child) to the selector:

But that didn't work.

View 6 Replies View Related

JQuery :: XML Looping Through Nested XML Document And Updating Page Elements Dynamically With XML Data?

Jan 26, 2010

I have created two onClick events that i need to combine into one with jQuery. I am not sure how to do this.I have an unordered list:

<ul id="coverTabs">
<li class="currentTab"><a href="#">Individual</a></li>
<li><a href="#">Couple</a></li>

[code].....

View 1 Replies View Related

JQuery :: Selecting Groups Of Elements?

Feb 11, 2010

I am trying to easily fix 100+ blog posts where the customer has <pre>tagsto format code.

the issue is in wordpress when you hit enter you are given a new <p> tag, and setting the format to preformatted outputs code like this

<pre>line</pre>
<pre>line</pre>
<pre>line</pre>

[Code].....

View 3 Replies View Related

JQuery :: Selecting Elements Using Multiple Parameters?

Aug 4, 2010

Selecting elements using multiple parameters like here: $('descendant', 'ancestor').text(); seems to be way more popular than css-like syntax: $('ancestor descendant').text(); Do those two differ in performance, or is it just about being intuitive to particular people?

View 1 Replies View Related

JQuery :: :nth-child() Selecting Elements Of One Class But Not Another?

Aug 19, 2011

im experiencing a problem when using the :nth-child() selector.

I currently have a div that contains multiple divs. These divs have either the class 'labels' or 'labels-alt', I currently use the following code to change add/remove a class to one of these

function mOver1(n) {
$('.labels:nth-child('+n+')').toggleClass("labels-hover");
}
function mOut1(n) {

[Code]....

View 3 Replies View Related

JQuery :: Selecting Dynamically Created Elements?

Aug 18, 2010

Previously when developing my own modal windows I have been creating a "mask" div directly in my markup, in the CSS setting it to be display:none and then setting it to show() by jQuery when a button is clicked.

I'm sure there is a better way to do this but i'm getting a little stuck.

I tried adding the "mask" div and its content to the body using prepend() when my button is clicked but i found i then can't select any of the added elements in jQuery.

How can you select elements you have added to a page by jQuery?? Also if this is the right approach whats the best way to insert a block of html to a page??

View 2 Replies View Related

JQuery :: Selecting Elements By Name In Extremely Slow?

Oct 23, 2010

I'm having trouble using jQuery to find get select box values by element name. At the moment the code is in a for loop and it gets 8 different form values and puts it into an array. Currently this takes 1.5 seconds to execute which is far too slow as the user has to wait for it to finish. Here's the code which is inside the loop:

[Code]...

This when run executes instantly with no time delay. Why is the jQuery way so much slower? I'm all for saving 2 lines of code but not when it's 10x slower. Also I shouldn't need to put an id on the select box element to make finding it faster, the name value is already unique because I require the specific value once the form has been submitted.

View 3 Replies View Related

JQuery :: Selecting Elements From HTML String?

Jul 8, 2010

how can i select elements from a HTML string. i have used .get() to load data and i want to search for HTML elements within that data/string

$.get(nextHref, function(data) {
alert(data); // OK
// i tried
alert($(data).find("#posts").html()); // returns null

[Code]....

View 5 Replies View Related

JQuery :: Selecting Elements That Ajax Has Not Delivered Yet

Sep 17, 2010

Here's some pseudo-code for reference:

$(document).ready(
function() {
... // #1 some code that fetches xml and generates a dom structure... <ol id='bla'><li></li></ol> then .appendTo('#foo');
... // #2 some code that generates another dom structure to be inserted into $('#bla').
}
)

The snippet #1 fetches xml and generates a dom to be appended to $('#foo'). But snippet #2 refuses to work with the id's created by the steps in #1. My guess is it is because #2 ran before #1 finished.

How do I make it so that #2 can reference the id's created by #1? Do I make #1 syncrhonous? Is there a way to make #2 run only after #1 is done? Do I just include onclick to the elements created by #1 -- I was hoping to avoid this because it appears the jQuery collective frowns on this.

View 1 Replies View Related

JQuery :: Selecting Elements That Not Have Visibility Hidden

Sep 15, 2011

I have a page where I have images that may have visibility 'hidden' or 'visible'.

So how do I ensure I animate (and other 'manipulations') only visible images when mouseover them and not the hidden image?

Must mention I want to do this without any use of css classes or other non-jquery made css.

View 2 Replies View Related

JQuery :: Selecting / Operating On Multiple Elements?

Aug 12, 2010

I am creating an FAQ type page with rows of questions that will drop down the respective answer when clicked. I have it mostly working, except I can't find a way to close all answers before opening the next one. I have tried everything I can think of (or search), but to no avail. I am using the following code, where QQQ1/2 are the questions, and AAA1/2 are the answer divs:

//Question/Answer
$(".QQQ1,.QQQ2").click(function () {
// check the visibility of the next element in the DOM
if ($(this).next().is(":hidden")) {

[Code].....

View 2 Replies View Related

JQuery :: Drag And Drop Selecting Incorrect Elements

Aug 5, 2011

Im working on some drag and drop logic similar to the jQuery shopping cart example, but I've run into a small hitch. If I double click on the LI within my 'dropped' area it causes them to become draggable again. I specifically set up drag to only work from one source list, so Im unsure how double clicking is causing this bug?

View 1 Replies View Related

JQuery :: Selecting Elements That Match A Regular Expression?

Sep 16, 2009

is there a way to select elements that match a regular expression? I have a set of divs with id = "wrap_n" where n is a progressive and I need to select them and for each 1 I have to add a function that togggle the "elem_n" div.

View 4 Replies View Related

JQuery :: Textarea Form - Selecting Array Elements?

Feb 22, 2011

I'm trying to add the text of a textarea form to the string that's contained at:
myarray[a][b][c]
It was easy to pull out the value of the textarea with this:
textinput = $('#mytextarea').val();
But then when I try to add the variable into the array, it doesn't work. I'm not able (apparently) to do this. Fingers crossed that I'm doing something dumb?

This doesn't work:
myarray[a][b][c] += newstringvariable;
Nor this:
myarray[a][b][c] = myarray[a][b][c] + textinput;
I'm guessing there is a very simple (probably syntax related!) solution to this. I'm open to doing this via jQuery or regular javascript.

View 4 Replies View Related

JQuery :: Selecting Multiple Elements And Storing Them In A Variable?

Mar 23, 2011

just a very basic question. Have a div (id - photos) with multiple images. 1) Does this select them all? $('#photos img') 2)If so, how can i capture this information? Like so -> var bunchOfStuff = ($('#photos img')); and 3) if so, why can't i do something like alert(bunchOfStuff.length)into code tags...

View 3 Replies View Related

Absolute Positioning Of Nested Elements

Oct 9, 2009

I am working on a puzzle that produces a container div.Within that div are produced a grid of 9.16. or 25 tiles.The tiles are positioned absolutely so I can be sure of their relative placement. The container div width and height is calculated according to a preset tile width and height (square actually). So the width of the container should adjust to either 3,4 or 5 tile widths and heights.The trouble is that the offset position of the top left tile is different relative to the container for each different set of tiles (even though it is supposed to be the same position relative to the container for each). I do this so I can apply dragging to the container div.The tiles will follow the container when it is moved and the game will not loose its place when tiles swap locations.(one tile is elected as blank, and tiles, one to left, right, top
or bottm, with game content, will swap location with blank when clicked)

View 5 Replies View Related

JQuery :: Selecting All Input Fields, In A Iteration Over Table Elements

Jul 26, 2010

What I have is this html:

<div class="persons">
<table>
<tr>
<td>Name: </td>

[Code]....

Now what do I write in this iteration loop to first get the text from the FIRST name and age box, in the first <table> (so I can work with tem). And in the next iteration loop get the SECOND <table>īs input fields text values?

View 2 Replies View Related

Why Return False Stop Event Handlers To Run On Nested Elements

Oct 23, 2009

I have nested markup like this
Code HTML4Strict:
<li><span></span></li>
I have different click functions, one attached to the li and the other to the span.

When I click on the span they both run. Ending the span's event handler with return false; prevented that from happening, which is what I want. But I'm not sure I understand why it worked.. I know, for example, if I was clicking on an anchor, return false would stop the browsers default action of following the href value. Same for submitting a form, return false will stop this. I don't think I understand why this would stop a completely different function from being triggered..

View 7 Replies View Related

Show Form Elements By Selecting Checkbox?

May 11, 2011

Trying to build a dynamic part on my form by using a checkbox and <span>. Found a script that does exactly what i want, but uses a 'radio' in the script instead of a checkbox. And at that spot i need to be able to make multiple selections, so i need checkboxes.. In this specific case it's about geslacht='v' checkbox

My problems are:

1. My span doesn't start off at invisible
2. My function match_personalia_geslacht() works with a onChange, not with a onSelect.

Don't know how to get the same result with a checkbox.. So if someone can help me, i would be a happy man.

[Code]...

View 10 Replies View Related

Correct Syntax For An Nested Array Where Each Array Element Has 3 Elements, A Number And Two Text Strings?

Sep 17, 2010

What is the correct syntax for an nested array where each array element has 3 elements, a number and two text strings?

Code:

array = ['1, Old Man, Old Man','2 Black Sheep, Black Sheep',....]

should the text strings be in double quotes("")?

Code:

array = ['1, "Old Man", "Old Man"','2 "Black Sheep", "Black Sheep"',....]

View 3 Replies View Related

JQuery :: Access An ID Nested In A DIV?

Jan 21, 2010

I'm trying to access an ID nested in a DIV which for the life of me I can't figure out:

<div class="verificationTextBox">Verification:
<a id="download_now" title="Review more about CAPTCHA" rel="#modal1" > </a></div>
<script type="text/javascript">

[code].....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved