I want to apply a special class to the two last list items in an unordered list with jQuery. Like this:
<ul>
<li>Lorem</li>
<li>ipsum</li>
<li>dolor</li>
<li class="special">sit</li>
<li class="special">amet</li>
</ul>
How to? Should I use :eq somehow?
Thanks in advance
Pontus
...
I have a list of elements that I want to style in 3 different ways.
I want every 3rd list item to have the same class throughout the whole list.
For example:
<li class="A">Some Content</li>
<li class="B">Some Content</li>
<li class="C">Some Content</li>
<li class="A">Some Content</li>
<li class="B">Some Content</li>
<li class="C">Some...
Can a CSS rule select the portion of a box which contains text (or an inline block)?
For example, an HTML fragment like <p>The quick brown fox jumped over the lazy dog</p> might be laid out like this:
+--------------------------+
| The quick brown fox |
| jumped over the |
| lazy dog |
+-------------------...
1.parent > son
2.parent>son
the only difference is whether there is space before and after ">",
and how is this kind of selector supported by browsers?
...
How do I identify empty textboxes using jQuery? I would like to do it using selectors if it is at all possible. Also, I must select on id since in the real code where I want to use this I don't want to select all text inputs.
In my following two code examples the first one accurately displays the value typed into the textbox "txt2" by t...
Hi All,
I'm a bit confused on how to properly select a parent item, that is 2 DIV's up.
In other words, my HTML looks like this:
<div>Folder</div>
<div class="file_info">
<a href="test.jpg">Test File</a>
</div>
Here's my current jQuery:
$("a[href$='.jpg']").addClass("Image");
However, I don't want to add the class to t...
I need the text from the selected item in a drop down.
Thanks in advance!
...
In the error console concerning a math lab program, there is a continuous error reporting about a bad selector. What is a bad selector?
...
I'm trying to obtain a specific li element from a unordered list.
I'm doing it this way:
var listItem = $('ul.selectedItems').filter(list[i].ID);
Any idea of why this isn't working?
...
Hi all.
I have a jquery selector with following syntax.
$('input[type=image]').not(".xyzClass").click(function{//some functionality})
So this puts a specific click functionality for all the components which are of type image and does not have class "xyzClass".
*I have modified the question to reflect latest changes, some of the answ...
In the following code, how do I select all the <tr> elements that have a <td> with an image that ends in cancelled.png? I am at a loss...
<table>
<tr> <----- select this whole tr
<td>
<img src="/images/icons/invoice-cancelled.png" alt="cancelled" />
<a href='/orders/invoice.aspx?invoiceid=63'>X1087</a...
I want to start a new thread using a C function, not an objective-C method. I tried
[NSThread detachNewThreadSelector: @selector(func) toTarget: nil withObject: id(data)];
where I have
void func(void *data) {
// ...
}
and data is a void *, but I get a runtime crash in objc_msgSend, called from
-[NSThread initWithTarget:selector...
I'd like to obtain a li item from an unordered list using the id attribute of both elements as part of the selector.
This is an example of how I made it work using the ul css class:
var listItem = $('ul.selectedItems li#' + opt.list[i].ID);
I tried to use the following approach with no luck:
var listItem = $("#" + opt.name).childs.f...
Been struggling with this simple selector problem a couple of hours now and must be missing something obvious. I have a <ul> in which some <li>s have nested <ul>s. Each <li> contains a link and when this is clicked I want to execute a function (rather than navigate), but importantly, this should only happen for the links contained in the...
Can somebody advise me with jQuery selectors.
I have a HTML list (see below) with four flag images in it. When a user rolls over a flag for example italy, I want it to fade out all the other three flags to 50% opacity.
<ul id="flags">
<li id="German"><img src="images/flag_german.jpg" /></li>
<li id="Italian"><img src="images/fl...
Hi i need set focus to the element that is immediate next(and in other case immediate prev ) to the current element
eg
<li>item1</li> <- prev element (get this element)
<li>item1</li><- current element
<li>item1</li> <- next element (get this element)
<li>item1</li>
this is what i used
var curr = (event.target).next()...
I'm having huge variations in performance depending on how I express my selectors. For example, look at these 2 selectors, which select exactly the same elements:
A) someTableRow.find("td.someColumnClass").find("span.editMode").find("input")
B) someTableRow.find("td.someColumnClass span.editMode input")
I would expect to B) to be fast...
I was wanting to associate a set of rectangles with corresponding actions, so I tried to do
struct menuActions {
CGRect rect;
SEL action;
};
struct menuActions someMenuRects[] = {
{ { { 0, 0 }, {320, 60 } }, @selector(doSomething) },
{ { { 0, 60}, {320, 50 } }, @selector(doSomethingElse) },
};
but I get the error "ini...
I understand that in jQuery, it's advantageous to be more specific when using selectors so that jQuery doesn't have to traverse the entire DOM to find what you're looking for. For example, $('span.description') is better than just $('.description') if I know that the description class is only ever applied to <span> elements.
Is this the...
I have an array of element identifiers, coming back from some server-side validation. The IDs aren't prefixed with a '#'. Rather than going through the array and prefixing a # to each member, is there jquery means of directly selecting all elements by their IDs?
...