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
ADVERTISEMENT
Nov 17, 2011
I have a large number of "li"s with the same class - i.e;
<li class="month01Days"></li>
:
:
[code]....
View 1 Replies
View Related
Mar 12, 2007
I am wondering if it is possible to get the response from a method
within a given page, and that function alone? Traditionally, I have
been getting the response from the Page_Load method of the targeted
page, but now I want the response from a particular method on the
target page:
Public Sub SomeCallback(ByVal sender As Object, ByVal e As EventArgs)
'RETURN XML FOR CALLBACK
End Sub
View 4 Replies
View Related
Dec 24, 2009
I am putting together a validation function and am having trouble with targeting multiple elements.[code]an onclick event fires my validation function. If any of the fields are empty, the appropriate error message should display.This sort of works. If all of the fields are empty, only the error message of the first element is displayed, not all 3.
View 1 Replies
View Related
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
View Related
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
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
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
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
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
Jun 12, 2010
Let's say I have this paragraph..<p>My dog is brown.</p I would like to accomplish this.. <p>My <span class="animal">dog</span> is brown.</p> So, I want to use JavaScript to find all "dog" strings inside the paragraph and wrap them in a SPAN element of a given class. I would love to have a plug-in that does that... like this: $("p").findAndWrap("dog", "<span class='animal' />"); I know this can be done in JS, but I'm not particularlyexperiencedin JS string manipulation, so it would take a while until I would accomplish this...Is there a plug-in that does this?
View 7 Replies
View Related
May 12, 2011
I want to do something like this
<div>
<p>
<p class="active">
[code]....
View 7 Replies
View Related
Feb 26, 2006
All right I have a javascript that parses my .xml files and writes the contents to individual elements in my page via the innerHTML method. That is okay for one page but what if I want to have all my pages in one xml file? Ex. I have a page called home.xml that has all the content for the home page. Another xml file for an About us page in about_us.xml and etc. What if I didn't want to have them in seperate files but in one xml file called site.xml? How would I tell my javascript which to node(?) to use. I tried things like changing firstChild to secondChild and so forth. I thought that if i was to change that index value from 0 to 1 that, that would do it for me but it didn't. I gave each page an id attribute but didn't know how to access it. Code:
View 2 Replies
View Related
Jul 19, 2010
While I am an amateur beginner when it comes to JavaScript, I feel that I can at least handle the scripting language to a level which suits my needs, however earlier today a friend asked me if I could lead her to the right direction with a class task of hers. Basically, the project at hand is to create a snippet of JavaScript which, when the user clicks the content of an HTML paragraph element, should replace said paragraph with a <textarea> and allow the user to alter the paragraph's content. Of course the textarea should be accompanied by a save and a cancel button, but seeing as it is a JavaScript class she's taking, the saving shall only be client-sided.
However, the catch is that she will not be allowed to use the innerHTML property.
So, to the question: how would one go (if it is possible, but I highly doubt it isn't) with making something like:
I do feel this could be done in a more smooth looking and operating way by using the contentEditable attribute, but apparently the teacher asked for a textarea.
View 6 Replies
View Related
May 14, 2010
I have 10 images on a blank page, all have the exact same source. I want to change all 10 of their sources with javascript to all be one new source(from source1.jpg to source2.jpg in code below). [code]I know I could run a loop and change all 10 of them individually in the loop, but I can't help but think there is a more efficient way. I was thinking of just making them div tags of all the same class and use the image as the background and then using javascript to change the class property. Basically I am asking what you think is the fastest processing time for the user, while also keeping the code very small.
View 2 Replies
View Related
Nov 2, 2007
i have 10 textareas that need to be converted in to identical fckeditors (same toolbar, skin and dimensions) right now im repeating the block below 10 times where the just the new FCKeditor ('textareaID') is different. the page weighs in at over 700KB ... fckeditor.html, fckeditor_gecko.js, fckeditor_area.css, etc are all loaded multiple times
im sure there is a better way of implementing this so each of those pages are only loaded once. does anyone know how?
var oFCKeditor = new FCKeditor( 'homeBody' ) ;
oFCKeditor.BasePath = "fckeditor/" ;
oFCKeditor.ToolbarSet = "Basic";
oFCKeditor.Width = 500;
oFCKeditor.Height = 300;
oFCKeditor.ReplaceTextarea() ;
View 1 Replies
View Related
Nov 6, 2007
I am trying to show/hide all the elements with a specific id ....
View 1 Replies
View Related
Oct 30, 2011
I am currently attempting to write a function that retrieves the name attribute from a list of items with a specific class name. To illustrate:
Code:
Show types of food:
<input type="radio" name="food" id="fruit" onclick="setVisibility('fruit')"/>
<label for="fruit">Fruit</label>
<input type="radio" name="food" id="vegetable" onclick="setVisibility('vegetable')"/>
<label for="vegetable">Vegetables</label>
<li class="art" name="fruit">pear</li>
<li class="art" name="vegetable">celery</li>
<li class="food" name="fruit">banana</li>
<li class="food" name="fruit">grapes</li>
<li class="food" name="fruit">orange</li>
<li class="art" name="fruit">grapes</li>
<li class="food" name="vegetable">lettuce</li>
<li class="food" name="fruit">apple</li>
<li class="food" name="vegetable">spinach</li>
<li class="food" name="vegetable">cabbage</li>
I would like create a function called setVisibility to iterate through all the list items where class=food and return the value of the name, so that I can compare that to the radio box, and set visibility accordingly.
View 3 Replies
View Related
Sep 7, 2010
I know this does not work, but hopefully you can see what I am trying to do. Only the first value is tested, but I want all of them to be.
[Code]...
Pretend there are like 10 more cases with more numbers with them. Currently this will only text to see if x is 0 or 42. How do I get it to test for the other numbers?
View 7 Replies
View Related
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
Jan 24, 2010
I am trying to do is load new content into a form without resetting the form. I have about 10 checkboxes, once 4 are selected I would like to reload a div in the page to insert four corresponding textareas with the same id as the checkboxes. So for example the checkboxes:
Code:
<div id="page_select">
<input type="checkbox" name="option1" id="option1" value="Home" /> Home
<input type="checkbox" name="option2" id="option2" value="About" /> About</div>
There would be about 10 after 4 are selected than four divs with textareas are loaded onto the page - These textareas have the same id in order for the right ones to load. If your wondering why not just hide the textareas and show when then have been selected by the checkboxes, its because they have a wysiwyg editor attach so it would start to load slow after I add say 10-20 different textareas.
Would this work:
Code:
$(document).ready(function() {
$('#reload_1').click(function() {
//var names = [];
var myScripts = new Array(4)
$('#page_select input:checked').each(function() {
names.push(this).attr("id");
});
$('#content_div').load('external_content.php.html # . + '. myScripts[0]);
$('#content_div').load('external_content.php.html # . + '. myScripts[1]);
$('#content_div').load('external_content.php.html # . + '. myScripts[2]);
$('#content_div').load('external_content.php.html # . + '. myScripts[3]);
If I had all the divs and textareas in external_page.php and load only the ones needed.
View 4 Replies
View Related
Mar 11, 2011
I have following little script that applies to my entire html page:
$("td[id*='MSOZoneCell_WebPartWPQ']>table>tbody>tr>td").each
(
function()
[code]....
View 19 Replies
View Related
May 19, 2010
i have a xml document (static) that I need to test what is in a grand child element. The real application is a jqGrid. I have a onSelectRow operation going on. I can click on a row and get a response (in a alert window) for any root children. But how do I do this for anything deeper in the tree? A portion of my xml is attached.
[Code]...
View 2 Replies
View Related
Jul 25, 2009
If my understanding is correct
Code JavaScript:
$("#foo").appendTo("#bar");
will adjust
Code HTML4Strict:
<div>
<p id="foo">My Foo!!!</p>
</div>
<div id="bar">
</div>
[Code]...
View 5 Replies
View Related
Apr 29, 2010
I have a JQuery lightbox popup but am struggling how to control the content of the lightbox. all the examples given on the internet are from anchor links that are fixed. I however, need to use it from images pulled from the database so therefore the content will be different depending on what image is clicked. I already have the content I need in a div, so is there a way of targeting that div so it is displayed within the lightbox?
View 2 Replies
View Related
Jun 13, 2009
I'm customizing the cycle plugin a bit from [URL] , which slides through a number of items.The issue I have is selecting a child object, to get its 'alt' attribute, and display it as a description. Using the default example:
function onBefore() {
$('#output').html("Scrolling image:<br>" + this.alt );
}
...works great when each item is an image. But I need to link each element, so my markup looks like this:
<div id="slideshow1" class="pics">
<a href="portfolio.html" title="Go to Project"><img src="tree.jpg" width="200" height="200" class="featuredimage" alt="Tree Branches" /></a>
[code]....
I'm not sure how to get the child element's alt attribute. I've searched through jQuery documentation and googled around, but can't get it working.
View 1 Replies
View Related