JQuery :: $(this).next() Not Matching Sibling Table?
May 12, 2009
Trying to hide a table that's a sibling to the anchor to which theclick event is being called. It works, with any element but a tableas a sibling. My code/markup:
<script type="text/javascript">
$(document).ready(function(){
// show/hide details
[code]....
View 1 Replies
ADVERTISEMENT
Jan 31, 2011
I have a single-cell table with a bunch of items within divs like item 1 below. The values in the divs are categories.
Following that (item 2 below), I have several single-row, two-column tables where the first column represents a Name (the item I want highlighted) and the second column is one or more of the category items (subset of item 1).
<div class="view-display-id-attachment_1">
<table>
<tr>
<td>
[Code].....
This doesn't work and I'm hoping to generalize it but I'm not sure if .field-item-* will work.
View 2 Replies
View Related
Sep 2, 2010
Such is the structure of my HTML:
<table>
<tr>
<td id="myHeader">
<input type='checkbox'>Header
[Code]....
I am using an ASP.NET Repeater control to create N number of code patterns similar to that above. The server code leads the input controls based on DB values. I want to default the second table to be hidden if the checkbox is blank (not checked) and shown if it is checked. I also want to duplicate this behavior on the click of the checkbox.
View 2 Replies
View Related
Aug 23, 2010
I've made a function for getting a ID for each sibling in a tree. Lets look at this DOM:
<ul>
<li>Five</li> //sibling ID 1
<li>Six</li> //sibling ID 2
<li>Seven</li>//sibling ID 3
</ul>
Here is the function:
function getSiblingId(elm) {
return $(elm).siblings().size() -$(elm).nextAll().size() + 1;
}
And here is how I use it:
var id = getSiblingId($('ul li:first-child')); // id = 1
Is there a more elegant way to get the same result? The work done in the getSiblingId-function has a lot of overehead.
View 1 Replies
View Related
Apr 16, 2010
I have an unordered list element which has click events registered. What i want is to be able to find the nth relative sibling to the list item that is clicked. In prototype I can simply say $(elm).next(3) or $(elm).previous(3) for the 3rd sibling forwards or backwards from the current sibling.
In JQuery there doesn't seem to be a way of getting a sibling relative to the current one, other than the immediate next() or prev(). So if I want the third previous I have to do this inJQuery
$(elm).prev().prev().prev()
View 2 Replies
View Related
Oct 27, 2010
I made a table with some customer information. It holds an id (hidden for the users), a company name, a phone number, an e-mail address and so on.
Inside every table row, I've made a "delete" button that should delete the relevant row in that table (see "<td class="delete">"). What I would like to do is getting the customer id that is hidden inside the first (hidden) <td> of the table row you wish to delete. I'm quite new to jQuery and I realy can't find a sollution for it. Here's my HTML [code]...
The alerts are working fine I guess. I've got something like "[object Object]" for the first alert and "object HTMLTableCellElement]" for the second alert. The other 2 testrules don't work. Firebug gave me the error message "$(this).parent().children("td")[4].text is not a function", but for now, I realy don't know what I'm doing (wrong) in those last 2 rules. Anyone who could help me out with this newbie problem about parent, child and/or sibling elements?
View 2 Replies
View Related
Jun 15, 2010
I have the following style markup:
<h2>
<span class="status">
UNDER OFFER
</span>
[Code].....
As i'm trying to add an overlay image to the hyperlink so it will appear on top of the image that is already there (css absolute and z-index).
View 5 Replies
View Related
Jun 14, 2010
Consider the following:<div id="item-1">
<a href="#">The Link</a>
<div>The contents shown on hover only</div>
</div>
I'm positioning elements absolutely. I want the child DIV to show when I hover over the link. Here is how I'm accomplishing this:
$("#item-1 a").mouseover(function() {$("#item-1 div").fadeIn('fast');})
$("#item-1 a").mouseout(function() {$("#item-1 div").fadeOut('fast');})
This works wonderfully. But I would like to make this generic so that I need 2 lines of code, not 2 times however many items I have.
View 1 Replies
View Related
Oct 5, 2009
I'm trying to set a width of a span class based on the width of the image inside of it. I've got a container that will also have a bunch of images... some of them will have captions and will be wrapped in a class "caption"... some will not be wrapped in the "caption" class. I'm trying to loop through the container... find all the "caption" classes... and then set the width of the caption class based on the width of the image inside of it. Here's what a basic image with a caption will look like:
<span class="caption fltrt">
<img src="" alt="" />
caption goes here
</span>
I'm able to look through the containing div and locate all the images and then get their width using the following:
// Find all images in the overview section
var overviewImgs = $(".overview-content").find("img");
// Get the width of each image in the overview section
[code]....
I can't figure out how to loop through and find all the instances of "caption" and then set the width of the "caption" class based on the
width of the image inside of it.I can find all the "caption" classes... and I can find all the images and get the image widths... but I'm not sure how to combine these two so I am only finding the images inside of the "caption" class and then setting the "caption" class width based on the width of the image inside of it. The images are added by a separate content developer and can be any size. Not all images will have captions... only the ones wrapped in the "caption" class.
View 2 Replies
View Related
Jan 5, 2012
I have a question about a selector.
How can I type: the next sibling of the section with id gedicht1 ?
View 1 Replies
View Related
Oct 8, 2010
I'm working with jQuery on a form where each input element is contained in an <li> element.
Some fields are read-only, identified by a class ".readonly", and I'd like to bind a jQuery function to these fields' "focus" event, to send the focus to the next input whose class is not read-only.
But, because of the containing <li> elements, I don't think .next('input') will work, since the <input> tags aren't siblings.
Is there a simple selector that will do the job without having to climb up and down the DOM via parents and children? To me that feels unsatisfactory and brittle, because should the designer decide to change the layout (lists within lists, <div>'s within <li>'s), my DOM-climbing code might break.
View 5 Replies
View Related
Dec 13, 2011
I have two divs: #div1 and #div2. what I'm trying to do is attach the second div to follow directly to the right of the first div, but I'm doing something wrong with the left property:
$('#div2').hide().insertAfter($('#div1'));
$('#div2').show().css({$('#div1').css('left', 100%)});so to recap, just trying to insert the second div directly to the right of the first one.
View 6 Replies
View Related
Aug 22, 2009
I have the following layout for my page in ASP.NET:
<div id="content">
<div id="leftnavcover" class="leftnavcover"></div>
<asp:PlaceHolder ID="ph_leftnav" runat="server">
<div class="leftnav" id="leftnav">
<asp:Repeater runat="server" ID="rptr_LeftNav">
<HeaderTemplate> .....
Which renders the following HTML:
<div id="content">
<div id="leftnavcover" class="leftnavcover"/>
<div id="leftnav" class="leftnav" style="left: 0px;">
<ul><li>
<a id="ctl00_rptr_LeftNav_ctl01_hyp_LeftNav" class="LeftNavLink" href="services-subsection-1">
Services Subsection 1</a>
<div class="leftnavmenu" style="display: block;"> .....
And I have the following JQuery script:
$(document).ready(function() {
$("a.LeftNavLink").mouseover(function() {
$(this).next("div.leftnavmenu").slideDown(500).siblings("div.leftnavmenu").slideUp("slow");
});
});
The problem is that when I bring my mouse on top of one of the .LeftNavLink's, it slides down the corresponding .leftnavmenu, but it doesn't slide the sibling divs back up when you put your mouse on top of another .LeftNavLink, which is what it is supposed to do. Anyways, I got this code from: [URL]
View 5 Replies
View Related
Oct 19, 2010
What is the selector to disable all form elements on the same 'level'? What I have is this:
Code:
<form>
<input id="element1" name = ........ />
[code]....
View 7 Replies
View Related
Aug 6, 2010
I want to toggle the next sibling of a link in a list like this,
Code:
<ul>
<li><a href="#">1</a></li>
<li><a href="#">2</a>
[code]....
first of all, it seems fine - I can toggle the targeted sibling, but why after the first toggle at any parent, I have to click twice sometime to hide other siblings when I click/ toggle at the current parent? [URL]
View 15 Replies
View Related
Aug 14, 2010
I have a table which contains multiple rows. The table has an unknown number of columns.
One of the TD's in the row has an 'A' tag containing the HREF property " /_layouts/DocIdRedir.aspx? somenumber" Let's call this TDSource and ASource
A sibling TD in the same row which has a class of ms-vb-title contains2 links- the'A' tagI want to update the HREF property of is in a DIV with a class of ms-vb itx . Lets call this TDTarget and ATarget.
The highlighted components are unique per row. I need to get the HREF value from ASource in each row and update the HREF value for ATarget in the same row.
It's my first day on jQuery - I understand that I can use children() to getthe TR containing the relevant TD's, and I can see how to use :contains() to identify the specific source HREF property, but I can't understand how to link these bits of information together to do what I want.
View 5 Replies
View Related
Jan 16, 2010
I have just written some jQuery code that had to navigate to a parent sibling then 3rd child. My code was
$(this).parent().next('ul').children('li').children('span').children('input').attr('checked', 'checked');
Is there any way to optimize this I thought this would work
$(this).parent().next('ul').children('li span input').attr('checked', 'checked');
View 6 Replies
View Related
Mar 20, 2011
This is the table's HTML code:
Code:
<table>
<thead>
<tr>
[code]....
If I understood it correctly, I have to find the link's father element (parent()), then find the previous sibling (prev()), find its child (the other link) and finally check its text. However, this is not working...
View 4 Replies
View Related
Jan 25, 2011
The following function works fine. I was just wondering if there are any serious negatives to using so many parent, sibling and children type functions?
View 1 Replies
View Related
Sep 19, 2010
I have searched the forum and internet and experimented a lot with .each but couldn't get this to work:I have several divs with id="flash", and I want them all to flash when the site loads. Using this code only the first div flashes:
$(document).ready(function() {
$(window).load(function () {
$("#flash").effect("pulsate", { times:3 }, 1000);
[code]....
View 1 Replies
View Related
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
Aug 29, 2010
This should be pretty simple one ,yet I can't seem to figure it out. There are posts that are similar to my question on here, but they don't really answer my questions. The a user comes to the page, they're at a URL like such: [URL]..
[Code]...
View 12 Replies
View Related
Jun 23, 2010
<ul
id
="menu-main-navigation"
class
="menu"
[Code]...
View 1 Replies
View Related
May 14, 2009
I came across JQuery when searching for a solution to get matching column height with Divs. I have downloaded JQuery which appears to be one file named jquery-1.3.2.min I also have the following short script that I found, which I believe goes in the head area of the page.
The script works with jquery.
HOW TO DO:
1. I assume I need to rename my download file jquery-1.3.2.min to jquery.js ?
2. Do I need to edit the jquery file somehow in order to get the above script to work?
View 4 Replies
View Related
May 28, 2009
<div>
</div><div>I just found out that jQuery can match on partials,.. is this correct?</div><div>and if so how do I make it match on the whole text.</div><div>[code]......
View 1 Replies
View Related
Mar 27, 2011
im very new to jQuery and have a problem I cant solve by myself. I have an ul li list with items that match a later following div - the match is the id. That id is matching another following div by id. All elements are dynamically generated and can vary in depth. I have a working set with onclick fuctions, but I want to make this working in jQuery.
[Code]...
View 6 Replies
View Related