JQuery :: Selectors For Clicked Element?

Mar 2, 2011

I have an html file that looks like the following.

<div id="outline-container-1_1" class="outline-3">
<h3 id="sec-1_1"><span class="section-number-3">1.1</span> Counting </h3>
<div class="outline-text-3" id="text-1_1">

[Code]...

View 2 Replies


ADVERTISEMENT

JQuery :: Selectors Only Matching First Element?

Jun 4, 2009

I'm trying to do is simple "select all" checkbox script. The problem is, no matter what I seem to do, only first element is matched. $("input:checkbox").attr("checked", true); checks the first box only. Same with: $("input:checkbox").each(... I even tried copying this script directly from the jQuery documentation page: $("div").css("border","9px solid red"); It applies a red border to the first div on my page.. the example in the documentation applies it to all divs.

View 5 Replies View Related

JQuery :: Using Selectors With Click And Find Another Element Inside?

Jul 1, 2011

I'm trying to create a list of recipes which will on document ready all be hidden except the first one. And then when I click one of the dynamically added links (in a ul) in the sidebar I want the corresponding recipe to go from hidden to shown. I've managed to do everything really simply except I have no idea how to find the corresponding recipe when I click a link in the sidebar (the links link to the recipes with #recipe<number>)

$(".post").hide();
$(".post:first").show();
$("a[href*='#recipe']").click(function() {
$(".post").hide(600);
});

Somehow I need to access the id of the specific recipe, which I suppose should be possible since the clickfunction should store that somehow?

EDIT: I just realized that I could just use the href value as my id for the recipe (since its the same e.g. #recipe). However I'm having trouble using the variable that stores the href/id in the .show function.

$("a[href*='#recipe']").click(function() {
$(".post").hide(600);
var theHref = $(this).attr("href");[code]....

View 2 Replies View Related

Select Any Element - Hide The Element Clicked And Items

Jun 22, 2009

It is possible to make a script that hides the element clicked and this way hide the items I want.

View 1 Replies View Related

JQuery :: Get The Index Of An Element Clicked?

Apr 13, 2010

If I have a group of elements, <li>'s in a <ul> for example, is there a way I can know I clicked on n of them?

[Code]...

View 1 Replies View Related

JQuery :: Determining Which Element Is Clicked?

Jan 23, 2010

In my html head tag i have a script like as below

$(
function
(
)

[Code].....

I am trying to update some values on the page when an img is clicked. There are many img tags on the page. I am not sure how can i determine which one is clicked.

Do i have to add an onclick event to my img tags with some id parameter or is there a possibility to detect which element is clicked on the page without calling a function?

View 3 Replies View Related

JQuery :: Determining Which Element Was Clicked

Nov 18, 2010

I have several <a> tags with the class 'a-menu-description', and an equal number of divs with the class 'menu-description'.

I am trying to get it so that only one div opens for the appropriate <a> tag, but when I click any of the <a> tags, all of the divs open up.

Here is my code:

Does anybody know what I can add in so that only the div associated with the <a> tag opens as opposed to all of them?

[url]

View 5 Replies View Related

JQuery :: Finding Out Which Element Exactly Was Clicked?

Jul 14, 2010

I am working on a little project with fullcalendar but while writing some callback functions stumbled upon an issue: Fullcalendar generates html that looks like this: <a><span></span><span></span><span></span></a>.

Now there is an eventClick callback that is fired when clicking on that <a> element. However, in that callback I would like to know which <span> element was clicked.

View 2 Replies View Related

JQuery :: Get Position Number Of Clicked Element?

Jul 30, 2011

Let's say I have a table with 5 rows;

<table id="tbl">
<tr><td>Please</td></tr>
<tr><td>help</td></tr>
<tr><td>me</td></tr>

[Code].....

Now if someone clicks on the row with content "help" (2nd), I want to catch the click with jquery .click() and know within the jquery code that the user clicked on the 2nd <tr> element within table#tbl.

If someone clicks on the <tr> with content "this", my jquery code has to return 5, because its the 5th row.

View 3 Replies View Related

JQuery :: Read Clicked Li Element Text?

Aug 24, 2011

i am trying to make my custom made combobox with using jquery and ul li menus. So when mouse clicked to the li element i have to read its value and set its parent to the clicked element value etc. Basic selecting method. So how can i read the clicked li element value and set that value to the parent of it. Here my structure.

I want to read clicked li element text not other one i tried var htmlStr = $(this).text;

[Code]...

View 1 Replies View Related

JQuery :: Function - Element Is Clicked While SHIFT Key Is Pressed

Mar 24, 2009

i am trying to build a function that takes into account a click event and SHIFT key press event on a particular element.

so for example, i want to do something only when i click a box WHILE pressing the SHIFT key.

how do i program this using jquery?

View 4 Replies View Related

JQuery :: Toggle Checkbox When Parent Element Is Clicked

Aug 6, 2010

I have an <input type="checkbox"> whose immediate parent is an <a> tag. The <a> is significantly larger than the <input>.

I want the checkbox to toggle on/offwhether the <a> is clicked or the checkbox itself. I also wantto store the value of the checkbox after it changes.

This sounds simple butI'm having trouble with the event bubbling (as in, I don't understand it).

Here is my current code.

HTML:

View 4 Replies View Related

JQuery :: Perform / Execute So And So, When Anchor Element 'clicked'?

Jul 29, 2010

as you can tell by the following statements, i'm new to jQueryI'm trying to do the following (in plain english) without too much success.. ) when document ready.. 2) find the element with id 'next'.3) pull / take all 'li' elements, and perform so and so, all whilst excluding 'last' element.

$(document).ready(function() {
$('#next').click(function() {
$('li').each(function() { //for each li ..

[code]....

View 4 Replies View Related

Jquery :: Function - Swap The Class Of An Element When It's Clicked On

Jun 15, 2011

I'm trying to swap the class of an element when it's clicked on. Using jquery 1.6.1, here's what it looks like:

[Code]....

Now, for the sake of brevity�*i omitted some other stuff that is happening when they're clicked on. The problem is that the click event for .unchecked_container is firing fine and the class is changed, BUT when clicked on again�*the '.checked_container' click event is NOT firing.

View 1 Replies View Related

JQuery :: Select ID From Clicked Element And Pass It To The Server Using AJAX?

Apr 24, 2010

I wonder how you can select the ID of an element (li) you have clicked and pass this to the server to do stuff with it :-)

View 2 Replies View Related

JQuery :: Selecting Index Of Currently Clicked Item From Inside Another Element?

Sep 18, 2010

I'm trying to find the currently clicked index of .accordion_trigger from within another element.

When inside the .accordion_trigger click event I can simply do the below to get the current clicked index:

Code:
$('.accordion_trigger').click(function(){
var index = $('.accordion_trigger').index(this);
}
return false;
});

Obviously this doesn't work when called from within another element. I understand that 'this' is part of the problem but can't seem to find a way to form the code in such a way for it to produce a valid result. Thus far I only get -1 or 0.

When .accordion_trigger is clicked it has an "$(this).toggleClass('active').next().slideDown();" applied so in theory I shold be able to search for which of the .accordion_trigger's are "active".

I've also tried doing this via the below method but to no avail:

Code:
var current = $('.accordion_trigger');
current.each(function() {
if ($(this).hasClass('active')) {

[Code]....

View 4 Replies View Related

Stop Function When Element Is Clicked?

Nov 15, 2011

I have an auto running function which slides and changes content every 3 seconds.

But I also have another jquery effect which when you click, it also changes the effect, but at the moment I can't have both running at the same time as weird behaviour happens (when clicking, it changes then because 3 seconds have passed it changes again anyway).

We want a way where the user clicks to change, and the auto running function ceases until next reload of the page. code...

View 9 Replies View Related

Capture The Id Of An Element Being Clicked Within A Page?

Aug 23, 2011

Is there any way to capture the Id of an element being clicked within a page?

View 3 Replies View Related

Prevent A Click Handler Being Triggered When A Child Element Is Clicked?

Jun 1, 2011

I have two div tags, first div is the father and the second div is son Inside the father like this

PHP Code:

<div id="father"> 
<div id="son"> </div>
</div> 

[Code]....

My question is why the son inherits the father in the event.

I want when I click on the Father div implement the event, but when i click on the son does not implement anything because it does not have any event.

View 1 Replies View Related

JQuery :: Immediate Child Selectors?

May 21, 2010

How can i select immediate children of an element only. Like i have

<div class="widget">
<ul>
<li><a href="google.com">Google</a>

[code]....

View 1 Replies View Related

JQuery :: Adding Selectors To $(this)?

Oct 12, 2009

Writing a sortable list function. My <li> elements contain several items (headings, paragraphs etc) and I want to add a class to the headings when they've been sorted. I have this code in my sortable init:

receive: function(event, ui) {
$(ui.item).addClass('editable');
},

This adds class="editable" to my newly-sorted <li> element - cool. What I want, though, is to add this class to the <h3> within my <li>. I tried:

receive: function(event, ui) {
$(ui.item + ' h3').addClass('editable');
},

but this just gave a syntax error.

View 3 Replies View Related

JQuery :: 1.3 - Not All Selectors Work In IE 8?

Apr 23, 2009

I found that certain selectors work in all browsers except IE 8 and they need to modified. This selector pattern seem to work well in all browsers, including IE 8: jQuery("input[class='class_name'][type='text']") But this identical selector works in Firefox, Safari but not in IE 8: jQuery("input.class_name:text") In IE 8 it returns a "property not found" javascript runtime error. I don't know whether that the actual issue or if it is a side effect of some memory leak.

View 1 Replies View Related

JQuery :: Regex In Selectors?

Apr 29, 2011

I'm trying to test if certain radio buttons are selected, but the name varies. My boss is considering changing the names to further isolate them breaking the script as it works now. I'm trying to figure out how to test the new case just like it works now. Here's a link to my pastebin

View 6 Replies View Related

JQuery :: Selectors For Links <a>?

Nov 28, 2011

I am trying to assign a click event handler to any of the <a> elements in the code below:

<div data-role="content" id="picSpace" class="ui-content" role="main">
<div class="ui-grid-b" id="gamePics">
<div class="ui-block-a">

[code]....

View 5 Replies View Related

JQuery :: Use Variables Instead Of Css Selectors?

Apr 4, 2009

Can I do this:

function showDiv(curEl){
hideDiv();
$(curEl).css("visibility","visible");
}

View 6 Replies View Related

JQuery :: Square Brackets In Selectors?

Apr 9, 2011

While trying to get a selector to work with ids that include square brackets, I searched the forum and found that I needed to escape the brackets with '\'. However, while this works with my fiddle: can't get the exact same selector to work within my page in either FF or Safari. I've triple-checked the id and it is correct; I know that jQuery is working on the page because changing the selector to$('.nameinput') gives the expected results. can't change the id because I'm working within an existing application; I know I could add a class to the input and use that as the selector instead. I'd prefer not to and would just like to figure out why this isn't working.

View 1 Replies View Related







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