I'm a little confused about which jQuery method and/or selectors to use when trying to select an element, and then remove certain descendant elements from the wrapped set.
For example, given the following HTML:
<div id="article">
<div id="inset">
<ul>
<li>This is bullet point #1.</li>
<li>This is bullet point #2.</li>...
Hello there, I have a div with id kGrowl and inside that div I have another div that has a select element with name = mover. I try to use this selector:
$('#kGrowl:contains([name=mover])').length
But it is currently returning 0. How is my selector wrong?
Thanks.
Edit:
Gabriel's answer is best but I also realized its the :has attrib...
Hi, i am styling a navigation menu using the following css. I have found that it works perfectly in chrome but absolutely none of the css is beign applied in firefox or IE.
Is there something obvious that i havent done or have done here?
<style type="text/css">
#ddm {
margin: 0;
padding: 0;
}
#d...
Looking at the CSS3 specs, I can't find any way to select any element that has no children.
Let me explain.
<body>
<h1>Main Page</h1>
<div id="main">
<div class="post">
<h2>Article 1</h1>
<p>some text</p>
</div>
<div class="post">
<h2>Article 2</h1>
<p>some text</p>
</div>
</div>
</body>
I'm looking for a CSS s...
given the html:
<div>
<span class="a">a
<span class="b">b</span>
</span>
<div>
Is it possible to just select the first span and not it's children?
Calling $('div span.a').text() prints the 'b' in the child node as well as the 'a'
...
Hi,
I'm using jQuery's selectors, especially id selector:
$("#elementId")...
How should I determine whether jQuery has found the element or not?
Even If the element with the specified id doesn't exist the next statement give me: [object Object]
alert($("#idThatDoesnotexist"));
...
Hello StackOverflow.
I am using Cufon (http://cufon.shoqolate.com/generate/) to replace some text in a menu.
Problem is that I only need to style the first <li> of the first <ul>.
I have tried using:
Cufon.replace('#menu ul li > a', { fontFamily: 'Christopherhand', hover: { color: '#99c635'}});
With the > seperator, but it does not...
- (IBAction) someButtonCall {
if(!someCondition) {
someButtonCallBack = @selector(someButtonCall);
[self presentModalViewController:someController animated:YES];
} else
...
}
//Called from someController
- (void) someControllerFinished:(BOOL) ok {
[self dismissModalViewControllerAnima...
Hi there.
Im sure the solution is simple but I cant figure it out :(
I need to combine two jquery selectors in one selector:
$(this) + $('input[type=text]:first')
$(this) is e.g div#selected so the result should be:
$('div#selected input[type=text]:first').focus();
How to do?
...
Why doesn't $("#RadioButtons:checked").val() - id selector - work in Internet Explorer but $("input:radio[name='RadioButtons']:checked").val() - name selector - does?
<input name="RadioButtons" id="RadioButtons" type="radio" value="1" checked>
<input name="RadioButtons" id="RadioButtons" type="radio" value="2">
<script>
alert($("#Rad...
Hi guys needing a bit of help.
I am creating a one page personal site.
Each section has a menu in it to jump to another section, however i want to have a class added to menu for the current section:
i.e. if you are in about the about link would have a class 'current'.
This is how it looks.
<section id="about">
<nav>
<li><a href=...
So I have some code,
<div class="chunk" id="">
<div class="chunkContent">
<div class="textLeft" ></div>
<div class="textRight" ></div>
<div class="notes border">Notes...</div>
</div>
<div class="tools fl">
<div class="toggleNotes border">n</div>
<div class="addChunk border">+</div>
...
I'm puzzled... I have this function "colorWithHexString"... when I include it in the viewcontroller that's calling it then it works fine. But when I move it to a separate "BSJax" class and call it with the same input parameter it throws an unrecognized selector error. Here's the call:
BSjax *bsjax = [BSjax new];
NSString *hexString = ...
Hello all,
I am looking for good example code for using delegate and events in objective c?
i am familiar with delegate and events in C#.
so if someone can help me with few lines of code it will be very helpful.
...
I've got the following which will excludes all buttons, but how can I also exclude hidden fields?
$("#selector").find(":input:not(:button)").each(function (i) { // do something
I'm sure this is probably simple, I just can't find it.
Many thanks!
...
I have a "BSjax" class that I wrote that lets me make async calls to our server to get json result sets, etc using the ASIHTTPRequest class. I set it up so that the BSjax class parses my server's json response, then passes control back to the calling view controller via this call:
[[self delegate] performSelectorOnMainThread:@selector(...
Does the Prototype Javascript library have a selector that's equivalent to jQuery's :contains()? If not, what would what be "The Prototype Way" to selector/filter-down a list of elements that contains a particular string.
For example, using the following
$$('#some_div dd a')
I may get back an array of 50 or so links. I only want th...
jQuery selectors select from the document.
How do I select from somewhere else other than root?
Say I want to select some children from an html object.
For this
function dothis(obj)
{
$j("#tabs").removeClass();
$j("#tabs>ul").removeClass();
$j("#tabs>ul>li>a").each(function()
{
var tabNum = $j(this).attr("h...
Hi,
I was wondering how I could use JQuery to select the child of a parent?
I have the following.
$("#navigation a.subpage").click(function () {
$("#navigation ul ul")...
The HTML looks like this.
<li>
<a class="subpage"...</a>
<ul style="hidden">...</ul>
</li>
I need to somehow select the parents of the link. That would ge...
I need to apply a tooltip plugin to a bunch of different elements on my page. The only common property to work with a jQuery selector is that they all have a title property set.
I tried $('[title=*]') as a selector but this didnt work.
...