selectors

Is the vertical bar (|) valid CSS or Firefox specific?

I noticed this rule in Firebug: *|*:link { color:#0000EE; } I'm not sure that I've ever seen the vertical bar (|) before. It's in the about:PreferenceStyleSheet so it may be Firefox specific. What does it mean? Any link to a reference? I thought possibly that the vertical bar was an "OR", but that's the comma in CSS. ...

Make Javascript variable global w/ MooTools

I'm using mootools-1.2.3 at the moment and I'm having trouble getting a variable to be accessible outside of a function. I need to define the variable in the domready function, because otherwise the DOM hasn't been loaded and selector functions will not work (I can't place the script at the end of the HTML I don't have control of when t...

Easier way to get a jQuery object from appended element

Is there an easier/quicker way to get the element added using jQuery append: How to get the $selectors element: $container.append('<div class="selectors"></div>'); var $selectors = $('.selectors', $container); I tried: var $selectors = $container.append('<div class="selectors"></div>'); but that makes $selectors = $container Mayb...

jQuery help - How do I select only the first item of a wrapped set?

How can I select the 1st item in a wrapped set? I have $(":radio") This returns a wrapped set of two items. Is there any way I can select just the first item? Basically something like this but cleaner syntax var singleListItem = $($(":radio")[0]); That will probably work, but it looks hideous to me. Is there a better way to write this...

Converting an HTML Document to Selector based index file

I'm looking for some sort of tool that can take an html document and pump out a selector based representation of the file. For example: <div> Some text <ul class="foo"> <li>First</li> <li>Second</li> <ul> </div> And output a flat text file in the spirit of: div div #text Some text div ul.foo li Frist div ul.foo li Se...

Use attribute or selector

Which is better to select textbox: input[type=text] or input:text Which to use? ...

Find elements between selectors

Below is my HTML content <HR><HR><H3>Document_1</H3> <PRE>PART2_1</PRE> <PRE>PART2_2</PRE> <HR><HR><H3>Document_2</H3> <PRE>PART3_1</PRE> <PRE>PART3_2</PRE> <PRE>PART3_3</PRE> I want to wrap all the elements between <HR><HR><H3>......<PRE></PRE> into different DIVs. In other words I will have 2 <DIV>. I have tried...

Using JQuery, how do you select one element based on another's name?

If I have a bunch of numbered fields in a web form, like an invoice: < input type="text" name="Item1" /><input type="text" name="Desc1" /><br /> < input type="text" name="Item2" /><input type="text" name="Desc2" /><br /> < input type="text" name="Item3" /><input type="text" name="Desc3" /><br /> Using JQuery, how would I select the fi...

Selenium RC Having problems with XPath for a table

I'm trying to select an element given by: /html/body[@id='someid']/form[@id='formid']/div[@id='someid2']/div[@id='']/div[@id='']/div[@id='']/table/tbody[@id='tableid']/tr[7]/td[2] Now the html of that row I'm trying to select looks like this: <tr> <td class="someClass">some text</td> <td class="someClass2">my required text for verif...

How to find the first ancestor node whose tag is <tbody> with jQuery?

Suppose the jQuery object is $obj,how to select the desired ancestor? ...

jQuery, select TR's in table where column 2 data is constant?

Hi Guys, I have an HTML table. I need a jQuery selector to select only the TR's, where column2 (TD) text is equal to = "foo". Is this possible? <table> <tr><td>asdasd</td><td>foo</td><td>fsdf</td></tr> <tr><td>asdasd</td><td>xxx</td><td>fsdf</td></tr> <tr><td>asdasd</td><td>xxx</td><td>fsdf</td></tr> <tr...

Jquery selector problem

I have two in a table with ids row_26 and notificationrow_26. I want to highlight row_26. So I use either var deviceUID = 26; $("#row_" + deviceUID).effect("highlight", {}, 3000); OR $("tr[id^='row_"+deviceUID+"']").effect("highlight", {}, 3000); but when I do this. It also highlights the notificationrow_26 . Also the highl...

Using -performSelector: vs. just calling the method

I'm still kind of new to Objective-C and I'm wondering what is the difference between the following two statements? [object performSelector:@selector(doSomething)]; [object doSomething]; ...

jQuery delete class elements except with a certain ID

I need to hide() all class level elements of '.dd-container' except when that element has an id of '#tools'. I tried the following (which didn't work) but I'm pretty sure I fudged the syntax: $('div:has(.dd-container):not(#tools .dd-container)').hide(); ...

JS/DOM selector scoping

Is it possible to have some sort of Id scoping when manipulating DOM with JS? I use jQuery as my JS framework. For example: Is there any mechanism that would allow to select someDiv children of first or someDiv children of second, or do all ids on the page have to be unique? I know this would be doable using classes...

jquery and selectors

I want to have a click event on the body tag, but I have a div under the body tag which i dont want to have the click event on. I have tryed with this but that doesent seem to work correct: $("body").not("#InnerDiv").click(function() { alert("Hejhej"); }); The html: <body> <div id="1">1</div> <div id="2">2</div> <div id=...

Why does one of these jQuery selectors work and the other not?

$.prev("div.a").find('.b'). $.prev("div.a .b"). One works and the other does not. What's the difference? ...

jQuery live function not working

Can Somebody please tell me why this script is not working.. Its supposed to work, but doesnt, I am getting the id correctly, but Div's are not displaying properly.. My idea is to display one div based on the click, and hide the other Div's. Please help.. Script $(document).ready(function() { $("a").live("click", function(){ va...

More than one class breaks jquery selector?

Hi, I'm working on a table where all rows have at least one class. Some rows have two classes and others have a class and an id. I have a simple bit a jquery to hide and show rows onclick, however when all the attributes are set, nothing happens. If I remove the additional attributes, so that only those in the jquery script are used...

JQuery: Select html of an element, inclusive?

What's the best way to select the html of an element, inclusive? For example: <div id="testDiv" class="testClass"> This is just a test. </div> Whereas $('#testDiv').html() returns "This is just a test.", I would a selector that returns: <div id="testDiv" class="testClass">This is just a test.</div>. Thank you for your replies. ...