selectors

jquery ("#field") is null

Hello, I have a selectbox with month periods in it. Here is my code: $(function(){ $("#ppsub_ppterm_id").change(function(){ var term = this.options[this.selectedIndex].text; if(term == "Eenmalig"){ ...

jQuery selector

Trying to select anchor tags that are a descendants of a div with a particular id, say it is #mydiv1, #mydiv2 and #mydiv3. myFunction = function() { var theDivs = $("#mydiv1, #mydiv2, #mydiv3"); theDivs.hover(function(e){ $(this+" a:link").css("color","#99ccff"); },function(e){ $(this+" a:link").css("color"...

How to select and replace the whole page with jQuery

My design of a page forces me to refresh the whole page with html that I have loaded via ajax. $('html').replaceWith(data); Gives me errors. Any ideas? ...

Can't select SPAN sibling

Can't understand why this code changes color of DIV element to blue, but doesn't change color of a SPAN element. Any ideas? <html> <head> <script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; <script> $(document).ready(function(){ $("#prev ~ div").css("color", "blue"); $("#prev ~ span").css("color"...

css ":focus" pseudo-class and selectors

Hi there, I've been battling to get this right...basically I have the following HTML setup: <div class="box10"> <span class="label01">Name:</span> <input class="tboxes" type="textbox" /> </div> "span.label01" is an inline element, and appears to the left of the textbox "input.tboxes". What I am trying to do attach some style t...

css selector rules --ruleset for all elements within a selector?

With at-rules, it's possible to have a ruleset for elements during that at-rule event (like printing, mobile devices, etc.) But what about just for a specific selector? I am working on a sub page of a larger site, and I have to use the master stylesheet for any of my pages. Sometimes a style rule just gets trumped by a rule from the ma...

How to subfilter a jquery object which is a subset of $(this)

I've read the documentation over and over and I can't get why this doesn't work: From inside a function, calling the following: alert($(this).parent().parent().html()); returns something looking like this: <div class="something1"> <div class="whereThisStarted">stuff</div> </div> <div class="something2">stuff</div> <div class...

How to select first row of the first table in an html page using jQuery?

Suppose if I have multiple tables in my HTML page (without their 'id' attribute), so how can I select first row of the first table or any specific table using jQuery selectors? ...

jquery selection of elements with no visible children

Here's my goal: do something on an element, an <optgrooup>, if all of its children are invisible. My code below outlines the in red if it has any invisible children. But I want to do so only if all the children are invisible. If the element has any children that are visible, then don't highlight it. How can I tweak the jQuery select...

Jquery $(this) Child Selector

I'm using this on a page: jQuery('.class1 a').click( function() { if ($(".class2").is(":hidden")) { $(".class2").slideDown("slow"); } else { $(".class2").slideUp(); } }); With a structure in the page later that goes like this: <div class="class1"> <a href="...">text</a> <div class="class2">text</div> </div> This is wo...

CSS Selectors

What is the difference between these two CSS statements: h1 em { color:#ddd; } and h1 > em { color:#ddd; } As far as I can tell they do exactly the same thing (though according to what I've read at W3C in the first case em is considered a 'descendant' where as in the second it is considered a 'child', though I have no idea how tha...

Cannot find the right <div> with selector after loading the HTML

I hope I can find a solution to this one. Here it goes: After I have submitted my form to add a message to the database, I create a <div> with the load method. After that I do some stuff in the callback function. When the function to create the new <div> has finished, it returns to the calling function that is supposed to prepend the m...

Set a context so a direct children of body is never selected with jQuery

I have the following HTML code : <html> <head> </head> <body> <div id="never-selected"> </div> </body> </html> With JQuery 1.3.2, I would like to create wrapper around $() that allow you to select any element with any combination but the div #never-selected nor its content. I am trying to do it this way : _contex...

JQuery: How to find the input named "apples" inside $(this)?

Hello, I'm learning JQuery and have found the factory function $() with its selectors quite useful. However, I cannot figure out how to select within a particular element I have named as a variable. For example: var thisDiv = $("#myDiv"); // thisDiv looks like this: <div id="myDiv"> <input id="apples" /> <input id="bananas" /> </div> ...

jQuery: How to select "from here until the next H2"?

I'm setting up a very straightforward FAQ page with jQuery. Like so: <h2>What happens when you click on this question?</h2> <p>This answer will appear!</p> This is all inside a very specific div, so I'll be selecting the header with $('#faq h2'). Simple, right? Click on the H2, and use this.next() to make the next paragraph show up...

Set a different id for every new element in the callback off the load event

edited my original question The problem is the same for setting the id off a newly added element or if I use the argument noteid from the function. The result is that every element get's the same id if this function get's looped. How can I set a different id for every newly added element??? As it is now, the value in the submit event...

Need/want to pass an NSError** as an argument to performSelector

I want to invoke a selector of a method that has the usual NSError** argument: -(int) getItemsSince:(NSDate *)when dataSelector:(SEL)getDataSelector error:(NSError**)outError { NSArray *data = nil; if([service respondsToSelector:getDataSelector]) { data = [service performSelector:getDataSelector withObject:when withObje...

Using jQuery to copy value from image source's file name to process and paste into html?

Hi i'm trying to use jQuery/javascript to make my life easier. I'm trying to use it to auto fill in the various html elements with the name of the place and country which comes from the file name of the image. Below is a sample of some of the html i have to work with: <div class="boxgrid"> <a href="gallery/angkor - cambodia.jpg" title="...

html select option separator

How do you make a separator in a select tag? New Window New Tab ----------- Save Page ------------ Exit ...

jquery select divs with same id

hei guys i want to select two divs with the same id in jquery. how do i do it? i tried this and it did not work jQuery('#xx').each(function(ind,obj){ //do stuff; }); i have jquery countdown timers in a page, and i update them via ajax. some of these countdown timers repeat and that is why i need to use the same id on the divs. ...