JQuery :: Selecting ONLY The First Child
Feb 9, 2011
I'm having a problem with selecting only the first child of my content tree. What I have is
<div id="Ft">
<ul class="Ft_colum">
<li><h3><a href="#">Home</a></h3></li>
<li><a href="#">Demo link</a></li>
<li><a href="#">Demo link</a></li>
<li><a href="#">Demo link</a></li>
[Code]...
View 2 Replies
ADVERTISEMENT
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
Dec 15, 2010
how to select (or set the focus on) the first-child within an ordered list, effectively simulating a mouse click on the item.
View 1 Replies
View Related
Jul 19, 2011
This code works on my wordpress parent pages but not on child pages. The code output looks exactly the same on the parent and child pages when viewed in firefox's firebug.
[Code]...
To see it in action: [URL].. View the cart, which is a child page of the store and you'll see the problem.
View 2 Replies
View Related
Apr 27, 2009
In jQuery, how to select a parent element to a child if I attached a click event on the parent but also want a click event on a child within.
Let's say I have a the following code :
HTML Code:
There may be several of those classes in the page. I then use jQuery to replace the inner HTML to the clickclass div when clicked on with some other code and a input button (with an ID of, let's say 'save_button').
This works fine for that part:
HTML Code:
I then want to have the button clickable so that I can replace again the HTML in the div (like a save button). But if I try a separate event listener on the input button, it also fires the parent event. Even if I return false on the child event or use event.stopImmediatePropagation() in the .click child function.
I've managed to almost get it with the following code :
HTML Code:
If the event is triggerd form 'clickclass', then replace with HTML + input button
The problem is that whenever I try using .parent() with jQuery, it always tells me that parent() is not a function. I've tried various other ways of getting the parent object (the clickclass div) but can't get it to work.
View 4 Replies
View Related
Aug 27, 2010
I have a div, id is 'pages'. Inside 'pages' is a dynamic amount of divs id = 'posts' each followed by another div id='date_area'
Example:
HTML Code:
<div id='pages'>
<div class='posts'></div>
<div class='date_area'></div>
<div class='posts'></div>
<div class='date_area'></div>
<div class='posts'></div>
<div class='date_area'></div>
<div class='posts'></div>
<div class='date_area'></div>
... etc
</div>
I need a way to select BOTH the first occurrence of <div class='posts'></div> and the LAST occurrence of <div class='posts'></div>. Then I need to set different css rules for both of them. In CSS, I can use first-child, but this doesn't work in older browsers. CSS last-child does not work here because it targets date_area and also doesn't work in older browsers.
View 6 Replies
View Related
Feb 9, 2011
<div class="userbox posts" id="pst146996">
<div class="imgholder">
<img alt="Chris Hardin" src="http://codebix.com/bp/1633.png">
<div style="margin-left: 20px;" class="commentbox">
[code]....
i want already select .postlike in $(this) now i want to select the tagh1 who is in .commentboxelements.i want to change the h1's inside text 1 to 2 so i write the code
$(this).closest('.posts').children('.commentboxelements center h1').html('1');
i try this but it's not worked anyway how i can do this.
View 1 Replies
View Related
Jan 5, 2012
so i wrote this slider with some help from an admin, everything works as I would like it to but I'm trying to make it a plugin so i need to tighten up a certain part of the code:
(function( $ ){
$.fn.jmSlider = function() {
// get total width of all li elements in the slider
var wrapWidth = 0;
[code]....
what i would like to do is instead of using "li:first" and "li:last", i would like to use first-child and last-child so the element doesn't need to be a li, in can be anything that is the direct child of the parent container.
View 2 Replies
View Related
Nov 24, 2011
I have a difficult work around Jquery. I want to remove all li items from the ul except first li and last three li how to remove the li elements from these list.
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
[Code].....
View 1 Replies
View Related
Oct 28, 2010
I have created parent child checkboxes. When one child is selected, then parent of that child, other child of same name and parent of that same name's child will be selected... Now I want if I unchecked any child, then only same name of child and parents should be unchecked or if I unchecked Parent Child, then same name of parent and child will be unchecked.
[Code]...
View 1 Replies
View Related
Jul 23, 2005
I have a parent window that pushes a new window object onto an Array
with the following code :
OpenChild()
{
//totalNumWindowsCreated is global
totalNumWindowsCreated = totalNumWindowsCreated + 1;
childWnds.push(window.open(link, "child" +
totalNumWindowsCreated,"dependent"));
..
..
..
}
This pops up a new window with every call. In the child window I call
a parent function onbeforeunload, appClose() :
function appClose(){
if (window.opener && !window.opener.closed){
window.opener.CloseChild(getQueryString("application"));
}}
This is in my frameset tag of the child code :
<frameset ... onbeforeUnload='appClose()'>
The window.opener.CloseChild() function is called perfectly when I have
one child window open, but as soon as I create another child window
both of the open child windows don't ever call it. They do both go
into the onbeforeunload appClose() function, but do not call the
window.opener.CloseChild() function inside of this routine.
Anyone have any ideas why when I have two child windows open I can't
access the window.opener functions?
I have tried taking each new window out of the array and used the
following code in CloseChild() :
CloseChild()
{
//win and totalNumWindowsCreated are both global
totalNumWindowsCreated = totalNumWindowsCreated + 1;
var win = window.open(link, "child" +
totalNumWindowsCreated,"dependent");
..
..
..
}
View 1 Replies
View Related
Jun 24, 2009
I'd like to set the align attribute of only the first TD in a TR for an entire table but am not sure how to address them all in one go. Probably an Nth child thing or similar but not sure!
View 13 Replies
View Related
Jun 29, 2009
this is where I'm stuck:
$('dl.message-block dt').click(function () {
$(this).nextAll('dd').addClass('red');
$(this).toggleClass("toggle");
});
...selects all DDs of the definition list, but I only want to select the items after the corresponding DT until the next DT.
View 3 Replies
View Related
Aug 20, 2010
I'm using one piece of code to select a particular value from the dropdownlist. To select the default value after successful execution......
$(
"#titleDDL"
).val(
'- SELECT -'
);
But the desired output is got in Mozilla Firefox but not in IE7.
View 1 Replies
View Related
Jan 9, 2010
I'm trying to figure out how to select a value from a list that is filled dynamically using ajax auto suggest Take a look at the small code: when typing in a name by the keyboard this function is called:
[Code]...
View 6 Replies
View Related
Jun 28, 2011
This seems to be a peculiarone. Let me set the stage.I am selecting the href inside of ananchortag.I MUST disable all anchor tags inside my div.Here is the problem, I am redirecting old content to new content.I have over 1200 pages all with 1-20 anchor tagsAll of the anchor tags have a regular href url OR a javascript function.It looks like this:"javascript:open_window('detail1.html')"All I want is a way to extract the:detail1.html which can bedetail21.html ordetail.html also (thought about using slice to cut out what I need)
View 2 Replies
View Related
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
Jan 26, 2011
I've been trying some stuff with jQuery, especially zebra striping table rows. All the methods out there use a "table tr:odd" selector or similar to that.
I would like to select every 3rd row (1,4,7,10,...).
View 1 Replies
View Related
Feb 16, 2011
I've got a hidden template div that contains an <LI> that is cloned and added to an <UL> on the fly. The cloned <LI> items have placeholder IDs. What I want to do is find all the IDs *within the cloned <LI>* that has a defined string in it (and then replace that string with the proper index, etc.)
So, for example, here's the HTML of the template:
<DIV id='thisLineRowTemplate' style="display:none"> <LI class='arrow' id='thisLineTemplateLI'>
<a href='#ex_EXNUMBER'>
<DIV class='LABELCLASS thisLine_labelContainer'>
<TABLE height=100% width=100%>
<TR valign='center'><TD align='center'>EXLABEL</TD></TR>
</TABLE>
</DIV>
<IMG id='thisLine_checkmark_EXNUMBER' class='thisLine_checkMark_off' src="assets/checkmark.png" width=60px height=54px>
<DIV id='thisLine_item_EXNUMBER' class='thisLine_exNameContainer'>
<TABLE height=100% width=100%>
<TR valign='center'><TD>EXNAME</TD></TR>
</TABLE>
</DIV>
</a>
</LI>
</DIV>
And here's the code so far:
for(rowIdx=0;rowIdx<theRows.rows.length;rowIdx++) {
thisRow = $("#thisLineTemplateLI").clone();
$(thisRow).attr({'id':'thisLineRow_'+rowIdx, 'display':'block'}).appendTo("#theList")
$(thisRow 'select[id*="EXNUMBER"]').each(function() {console.log("Found a EXNUMBER")});
};
Line 4 is what's stumping me. The <LI>s are being cloned perfectly. I've tried a couple of different selectors but honestly, I'm still pretty new to jQuery, so some of the concepts continue to elude me. At this point, all I get is "Parse Error" on that line.
View 4 Replies
View Related
Mar 25, 2010
Like, I want to select the last two digits (like €50,25) to make it a bit smaller. I would put it inside a Paragraphs. Is there a selector for this?
View 3 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
May 24, 2010
When I click on my h3 tag I would like to do a replace on the next "dframe" element (not all "dframe" elements). I've tried the code below but it doesn't select the next specified element. I guess next() only covers the next sibling?
$(".regionfulldublin h3").click(function() {
$(this).next('dframe').replaceWith('<iframe></iframe>');
});
View 1 Replies
View Related
Jul 20, 2011
I have a table that has four columns in it. The second to last column has checkboxes in it. The last column has pulldowns in it with the class of "change_order". How can I make changes to the adjacent pulldown when the checkbox (in same row) is checked/unchecked? I am not able to select it.
function updateOrder(obj){
$j(obj).nextAll(".change_order").addClass("changedPD");
}
View 2 Replies
View Related
Jul 3, 2009
Does anyone know how i would go about selecting the next .slide after the one with .current in it? how can i get the div index of the .current class?
<div id="slideshow">
Ive got the action attached to somthing outside of the slideshow div so i can use .this.
View 1 Replies
View Related
Sep 5, 2011
I am very new to jQuery and I am struggling with using JQuery TabsI have 3 tabs on my page which open up different URL's, the problem I am seeing is that no matter what tab I select the selected tab is always 0. (The contents are correct just the tab selected is ncorrect.)My Java Script
$(function(){
// Tabs
$('#tabs').tabs({
[code]....
View 1 Replies
View Related
Apr 28, 2009
My basic code is something like
<div class="insidepost">
paragraph 1
paragraph 2
[code].....
View 3 Replies
View Related