selectors

How to get jQuery to find the first list-item, rather than all list-items?

I'm trying to implement a basic jQuery infinite carousel. As much for the learning process as for anything else (as a rule I'm not a fan of re-inventing wheels, but...I have to learn somehow, might as well start with the basics). I've managed to get the list to animate left happily enough, but I'm stuck when it comes to selecting the fi...

jQuery Find element else do nothing ?

Hi Guys, I am trying to use jQuery to basically wrap a bunch of CSS modifications via jQuery but on pages where the #IDs or Classes dont exist I get errors ? Like jQuery(".class").css(random_stuff) is not a function Any ideas what I can do to either "find" the elements and do nothing or ? ...

How selectorgadget works?

How selectorgadget.com works? Is there any link/page that explain the algorithm behind selectorgadget? thanks ...

jQuery reference to (this) does not work?

I have this href link with text either "attivo" or "non attivo" User can set the item to 'active' or 'closed' in the database with an ajax request $.post() I have 2 questions for these: I can't get the reference to $(this) to work.. I tried it with a normal link and it works, but not wrapped in if/else?? How can I prevent the user fro...

How Do I Select for Multiple Classes Using Nokogiri and Ruby

From a table element, I would like to select all rows that have the class even or the class odd. I tried the jQuery syntax: report.css("table.data tr[class~=odd even]").each{|line| parse_line_item(line)} but it threw an error, any help is appreciated, thanks. ...

Are CSS selectors a big performance hit?

Hi, I have a web application with bunch of HTML code. There are some style-attributes that I can't get rid of, but I was wondering if it's worth the cleanness to get rid of class-names and use CSS selectors instead. Do CSS selectors perform slowly? I'm talking about replacing class-name selectors such as .example with more complex sele...

How can I get the href of a <link> tag using jQuery?

Hi, I've seen lots on how to do this with an tag, and I have no problem doing it with that one, but I can't seem to retrieve the href attribute of a <link> tag. Even trying to grab the link tag at all: alert($("link").length); Gives 0. Any ideas? Thanks, Matt ...

FancyBox, Obtaining an ATTR of the item clicked

I have the following lines of code: $("a.quickview").fancybox({ ajax : { type : "POST", data : 'itemID=' + $(this).attr("name") } }); Which is binding on: <a name="614" class="quickview" href="/URL/index.cfm">quick view</a> I want data to post as itemID=614, but $(this).attr("na...

Why is the SelectTemplate Method run 2 times in debug mode?

Hello, debuging this class the SelectTemplate Method is run 2 times, but why? The first time the item is always null. public class PersonDataTemplateSelector : DataTemplateSelector { public override DataTemplate SelectTemplate(object item,DependencyObject container) { if (item is Person) { Person pe...

Passing methods/functions as args in Objective C

Hello, I am new to Objective C and I am trying to implement an async library which works with callbacks. I need to figure out a way to pass callback methods as args to my async methods so that the callback can be invoked when the task is finished. What is the best way to achieve this in Objective C? In Python, for example I could easily...

Javascript DOM howto?

Hi, I am a javascript noob. I would like to select the second 'p' element of the div.box. How do I do this? Thanks a lot! Tom ...

jQuery selector - style values

I got a series of divs like this: <div class="message" style="padding-left: 0px;">...</div> <div class="message" style="padding-left: 20px;">...</div> <div class="message" style="padding-left: 20px;">...</div> <div class="message" style="padding-left: 40px;">...</div> <div class="message" style="padding-left: 20px;">...</div> And I wo...

How should grouping be combined properly with child and descendant selectors?

Child and descendant selectors have been leaking to every element on my html structure and I found out that this happens when I combine grouping with it. This affects all elements on the whole document: ul#topnav > li a, a:hover, a:focus{ font-size: 14px; color: #C2C5CC; text-decoration: none; padding:0px; } while this only affe...

Prototype Selectors like jQuery ?

Hi Guys, Just trying to establish whether prototype can do something like $$('#ID a:last').css('color','#111'); Any ideas ? ...

$().mouseMove <-- Empty selector in jQuery 1.4

The following bit of code breaks in the upgrade to jquery 1.4: $().mousemove( function (e) { defaults.mouseX = e.pageX; defaults.mouseY = e.pageY; }); }; What appeared to be a reasonable fix was adding "html" as the selector, ex: $("html"). The fix works fine - except now when the user mouses off the page, it doesn't ...

sIFR header with inside span

I've got the following situation: <h2>This text is <span>pretty awesome</span></h2> I'm trying to give both a different style like this (only the css): h2 { font-size: 21px; text-transform: uppercase; line-height: 37px; height: 36px; text-align: right; margin-right: 10px; } h2 span { font-size: 16px; color: #666666; text-transform: l...

jQuery select elements with value between x and y

Hello <input value="1" /> <input value="10" /> <input value="9" /> <input value="4" /> <input value="5" /> I'd like to be able to do that kind of selection: $('input[value between 6 and 11]'); Which would give me the 9 and 10. Is there a way to do that ? ...

id vs class selection benchmark

Has anybody bench marked selecting elements with id's and class's from CSS and javascript? It would make sense that an element with an id is faster to select than if it had a class even if it was the only element with that class. Do I really need to be concerned? ...

Conditional Statement as Hierarchy jQuery

Is there a way to make jQuery use objects in a conditional statement as an object in a hierarchy. For Example, I want to validate that something exist then tell it to do something just using the this selector. Like this if ($(".tnImg").length) { //i have to declare what object I am targeting here to get this to work $(th...

How to check visibility of multiple div's in simpler way?

Currently i'm using below code which works well. $("#topperAtBaseLevel:visible, #lowerAtBaseLevel:visible, #midAtBaseLevel").hide(); any optimised code? (i cant use same class) i mean how to use :visible rightly? ...