JQuery :: Nth-child And Variables?
Nov 8, 2011I want to create a menu with 10 div in it and each one show one of the div (with the same number):
[Code]...
I want to create a menu with 10 div in it and each one show one of the div (with the same number):
[Code]...
<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.
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.
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].....
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]...
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");
..
..
..
}
Anyone know how to get Javascript variables into PHP variables or a MySQL database? Full question in the PHP section.
View 2 Replies View RelatedI have some JavaScript which is splitting out the different variable elements from the URL.Now, how do I set the internal variables?Then I want to set the variable ScriptHeading to be Change and the variable ScriptType to be NewThread.I keep finding all sorts of lovely code showing how to split out the various sections in many different ways, but I can't find anything on how to actually set these variables.
View 1 Replies View RelatedLets say I had a wrapped set of <p> elements. I understand how slice could return more than one element, but what is the difference between nth-child() and eq()?
$('p:nth-child(3)').css("font-style","italic");
$("p:eq(2)").css("font-style","italic");
$("p").slice(2,3).css("font-style","italic");
I am trying to update a progress percentage using jquery in my event handler. The first line works fine. The second line should be the jquery equivilent, but does not work.
event.target.icon.firstChild.textContent = progressPercent
$('event.target.icon').eq(0).text(progressPercent)
how to find this. I just need to know how to find child elements on a parent element that I already have the object for. The parent node doesn't have an id so I can't just get the ID and use the find functionality in jquery.
View 1 Replies View RelatedHow can i select immediate children of an element only. Like i have
<div class="widget">
<ul>
<li><a href="google.com">Google</a>
[code]....
I've got a reference to a TableCell and I'd like to use jQuery to get the first instance of an <IMG> tag within that TableCell, but can't get the syntax right, I understand how it would work if I were to reference the TableCell by and ID or class, but not when I have a direct reference to the cell, I've got:
What the jQuery syntax should be to get the first img tag within "tdRef"?
I've been staring at code for way too long. I have a data structure like:
<ul id="mylist">
<li class="active">Stuff <a href="#" class="movethis">Move</a></li>
<li class="active">More Stuff</li>
</ul>
How do I get the li that doesn't have 'a.movethis'?
This seems like a relatively straight forward problem. I've searced google and these forums. I just want to select this's last child. How do I do that?
View 2 Replies View RelatedI have a list (simplified version example)
<ul>
<li><a>Grandfather</a>
<ul>
<li><a>Father <span>Desc</span></a>
[code]....
I want to be able to select the span elements that have a sub ul (ie, Grandfather,Father, but not son or daughter. I tried $('#page-ui li:has("ul") span'), which works for the top level nav that doesn't have any children, but shows up for uncle and son and daughter since it applies it to all the spans inside the first li with a sub ul. I also tried$('#page-ui li:has("ul") span:first-child'), but that didn't help either since all the spans are the first childre
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]...
I want to automatic calculate the width of a child div. I have a parent with a fixed with and two children in there. The first has a flexible width due to his content (title of post) and is transparent. The second child contains only a background image and should always fill the rest-width. I tried it like this but it doesn't work [code]...
View 3 Replies View RelatedI'm using the following to sequentially change the background color of some list items. It works, but is there a direct way of putting a variable inside the n-th child parentheses, instead of concatenating? Second question, more CSSey, though. The highlight goes all the way across the page since the CSS bounding box is 100% for the li items. The lines are various lengths so I can't just set the bounding box to, say, fifty percent. Is there a way to use jQuery to make the bounding box, or background color only go to the end of the text?
View 1 Replies View RelatedIf I use an child selector like in [url] how can I prevent it from being applied to all tables?I need to select an child from only one table.
View 2 Replies View Relatedaccording to the docs this 'should' work in all IE versions except 6.Examples :
$("#gallery > img").css();
$("#gallery").children("img").css()
Even tried $("#gallery").find("img").css() None of those methods will work in all versions of IE(even 8). Works just fine in FF, Safari, etc...Is there a work around or another method of selecting the children of a selector in IE? I would really like to not have to add extra classes to those images just to select them.
I'm using the following code that adds to <a> tags to each <td> inside a table.
$(document).ready(function() {
$('.calendar td:not(.notinmonth.)').each(function() {
$(this).append('<a href="#" class="available am">AM: Available</a>').append('<a href="#" class="available pm">PM: Available</a>');
});
$('.calendar td:not(.notinmonth.)').each(function() {
$(this).has('.event').remove('.am');
});
});
The second half of the code looks to see if any of the cells contain an element with class 'event'. If one exists, then the '.am' anchor should be removed. However this does not appear to be happening. After carrying out a few tests with the 'alert' function, it looks as though the script thinks that every cell contains a '.event' element, but I have no idea why! Not only that, it doesn't remove the '.am' link from any of them.
Here is the markup for the table (the cell with 'Day 9' in it is the only one that should match having an '.event' element:
<table class="calendar"><thead>
<tr><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th>
<th class="weekend">Sat</th><th class="weekend">Sun</th></tr>
</thead><tbody>
<tr><td class="notinmonth"></td><td class="notinmonth"> .....
I have a drag and drop box. Don't know how to solve one problem. How to check if a drag and drop box have child elements?
View 2 Replies View Related<!DOCTYPE html>
<html><head>
<script src="js/jquery-1.4.2.min.js"></script></head>
<body>
<table width="100%" border="1">
<thead>
</thead>
<tbody><tr><td>
<input type="checkbox" id="del[]" value="1">
</td><td>alert</td>
<td>alert</td></tr>
<tr><td>
<input type="checkbox" id="del[]" value="2">
</td><td>alert</td>
<td>alert</td></tr>
</tbody><tfoot>
</tfoot></table>
</body><script>
$('tbody > tr > td').not(children('input')).click(function(){
alert('Doesn't has an input child!');
});
</script>
</html>
Simple stuff here
My HTML is like this:
<div class="feature">
<h2>Heading Goes Here</h2>
<img src="photo.jpg" />
[Code]....
What I want to happen is for the element inside the .feature class to appear when the <h2> of that <div> is clicked I tried using next() and a few other methods but it doesn't work as neatly as I want it to - how can I tell jQuery to just return the element within that div (and not all elements which are inside a .feature class)?
I have 2 lists on a page and I have a link set up to remove an li item from the one list. I need to check to see if there is a copy of that item in the other list based off an attribute in my li item called qid. How would I look for a child list item based off this custom
attribute? Assuming I have html like the following and I want to get the one where qid=14.
<ul id="ul1">
<li qid="12" id="ul1_1">adfaf</li>
<li qid="13" id="ul1_2">adfaf</li>
<li qid="14" id="ul1_3">adfaf</li>
</ul>