JQuery :: Get <LI> Parent Of <A>?
May 6, 2009I want to change the background color of a <LI> that contains an <A>.
I tried using
$('a').parent().css('background-color','red');
But it did not work.
I want to change the background color of a <LI> that contains an <A>.
I tried using
$('a').parent().css('background-color','red');
But it did not work.
Demonstration page: [url]
Adjust the CSS margins of the BODY element with the first slider. The yellow P (paragraph) element resizes to fit its smaller containing block, as I would expect.
Then, adjust the CSS border or padding of the BODY element with the second and third sliders. The P element does not resize, though its origin changes. Instead, it overflows its containing block.
Finally, adjust the margins again. The P element snaps back into its containing block.
As you can see from the source, this is jQuery 1.6.4 and jQueryUI 1.8 pulled from googleapis.com.
Edit: Client is Google Chrome16.0.889.0 dev-m.
I have a page which has a form and also one iframe in the same. there is a button on the parent form.when the button is clicked, i am submitting the iframe and parent both. forms are getting submitted. but when i do print_r for iframe values, it is blank
[Code]...
I have a page. In that page is an iframe, lets name it 'A'. inside A there is another iframe 'B'. there is a link on that page which on click opens a popup. In that pop up, there is actually a document upload facility. Now i want that after every upload (onSubmit), iframe A should refresh.
have done it many times but today its not working.
function validate() {
(window.parent.opener.location.href)=(window.parent.opener.location.href);
window.parent.opener.location.reload(true);// this is tried as well
}
I am trying to get the ID of a parent. For example:
<div id="parent_holder1">
<div class="child_div">child div instance one</div>
<br /><div class="child_div">child div instance two</div>
</div><!-- PARENT HOLDER 1 -->
<br /><br />
<div id="parent_holder2">
<div class="child_div">child div instance three</div>
<br /><div class="child_div">child div instance four</div>
</div><!-- PARENT HOLDER 1 -->
When I click any of the children with a class of 'child_dev', I would like to get the ID of the parent the clicked child is within. For example - if I click "child div instance three" it would return "parent_holder2".
I think this is a small problem but it won't work or I am blind.I have a box with the following code:
[Code]...
I have a page in an Iframe and when the user clicks a image (href), I want a value to be set in the parent page. I don't know why this is not working.. In the iframe page , dollar1 is the id of the Imagebutton, then I have a hidden variable id= setEndUser. On the parent page I have a textbox
id = Enduser.
$(function() {
$("#dollar1").bind("click",function() {
$("#EndUserT").parent().val( $("#setEndUser").val() );
});
});
Get ID of a clicked parent ID?
[Code]...
I am slightly confused, usually I can just find the answer from digging around the net and experminting but not this time! [code]...
I know the problem - I am inside another function which has become the new 'this' but how do I get back to the parent 'this' selector.
I know this might seem like a newb question,
but the following returnsnothingfor me, except a blank alert box...[code]...
I want to check if the image wrapped by a tag, so I write the [code]...
View 2 Replies View RelatedI have the following HTML.[code]When a link is clicked I need to get its grand parent's id and add it to the link as rel.I can do the second part but not the first part.For example when I click a link with title="Photo 2" I want to get its grandparent's id="strip_Photography or great grandparent's id box_ Photography.When I click title Art 4, then I want to get its grandparent's id strip_Artwork or great grandparent's id box_Artwork. etc
View 5 Replies View Relatedtake a look at the following source,
jQuery.fn.extend({
colorbox : function (option) {
// do some thing;
};
});
var cb = jQuery.colorbox =
[Code]...
code below the function set() to the keyup event for the class "Labels". the function checks to to see if the key pressed was chr(13), if it is not, MyIndex called, and this all works fine. When a chr(13) is detected the function set(this) is called.Inside function set(this) I need to get the name of the object's parent name, but can't figure it out.[code]
View 1 Replies View RelatedI would to achieve the same result of the below function without using callbacks .
The function is:
$("#user-options-menu").find('a').each(function() {
// now I want to filter any <a> tag with <li> parent
if (!($(this).parent().is('li'))) {
$(this).button();
}});
I've tried with$("#user-options-menu").find('a:not(li:parent)') but without result.
I just cant seem to get this right.
<table id="tableid">
<tr>
<td>text1</td>
[code]....
I have list of department id with view link (dislpaying in table1 and hiding table 2).If view link clicked, using toggle.. i can able to hide table1 and display the new table say table 2.i need to set the value of selected departmentid in table 2 ? how to do it in simple way...?
View 1 Replies View Relatedcurrent state:
html
.
html
<
[Code].....
I need to hide the "next" table.
But with my given example above, it just works for the first <a> Element.
In fact, if I press another the second or third nothing happend.
But why ? I cant get the reason... how can I hide the next table after the <p> tag ?
I have a table with a couple of rows with two cells in each row and each cell has couple of info like office name, address and phone number etc. Using jquery for each, the address is being pulled out from each cell and fed into google map geocoder object to get the point and plot it in the map. Now at each hit of an Address value, I would also like to grab the unique value of phone and office name from the current cell from which jquery is getting address value..I need those values so i can display those values in the InfoWindow of the map? How do I get those values?
<table class="OfficeInfo" border="0" style="width: 100%" cellspacing="10px" cellpadding="15px">
<tr>
<td class="Office1" style="width=40%">
[code]....
I've got a list similar to the following [code]...
I'm new to this jquery malarkey so I'm shooting in the dark somewhat here.
I've created an object with properties and methods. The object is associated with a form. The object iterates through the form and finds any inputs that are required. It then uses each to apply validation to each of the found inputs. From within each(), I need to access properties and methods of the parent object, but now this refers to the current collection object. How do I access the containing object?
View 1 Replies View Relatedwhy I'm not able to remove the class "hasLink" from the parent element that contains the class ".test"
<ul>
<li class="hasLink">
<div>
<a href=" class="link">link</a>
[Code]....
I wonder if there's any chance to get the parent's ID of an html comment.
Let's say I have the following comment inside the DOM[code]...
And I would like to know where is it contained asking for it literally.
I have tried with :contains("<!--this is a comment-->") but contains doesn't seems to support comments.
Not really sure how the best way to start explaining this, but I have a small script set up that activates a second section to an accordion to display information. The idea is that a table cell will be clicked and then the second according will activate displaying information relating to the cell that was clicked in accordion part 1.
I have managed to get it to update coding in the var's by hand, now I want to be able to get certain bits of information from a nested div that is hidden in the table cell (I know, very messy - but it will all be made a little less messy in the future when I have got the process correct).
[Code]...
I have several comments embedded in my website and I would like to be able to get the ID or the Jquery object refrence of the parent in which they are contained, for example, in the following code I would like to get the ID "container" just by locating the html comment as a string within the page[code]...
View 1 Replies View RelatedI have:
<p>Click here</p>
<div>cool content #1</div>
<p>Click here</p>
<div>cool content #2</div>
How if I click either <p> how do I select the <div> immediately following?
$(p + div).dosomething()
isn't working.