selectors

What's the best HTML attribute to use to store information for jQuery to parse?

Must Support IE6 and must Validate vs XHTML Strict 1.0! This is tricky to explain... I'm using a generic class name to initiate a plugin feature on an associated element. I also want to have options associated with the element stored in an attribute as well. <a href="url.com" class="popup" rel="900x900" >My Link</a> With this, jQue...

jQuery :contains selector to search for multiple strings

Assuming i have: <li id="1">Mary</li> <li id="2">John, Mary, Dave</li> <li id="3">John, Dave, Mary</li> <li id="4">John</li> If i need to find all <li> Elements which contain "John" and "Mary", how would i construct the jQuery? A search for a single string seems easy: $('li:contains("John")').text() I am looking for something like...

CSS div#id what for?

Hi, in some CSS code I found out this type of selector div#someid Is this formally correct? If the answer to (1) is YES, what's the need for the div selector before the #someid, shouldn't the id be unique in a valid web page? Thanks! ...

How can I change 'self.view' within a button method created outside of 'loadView'

Hey guys. So I am creating buttons dynamically within loadView. Each of these buttons is given an action using the @Selector method, such as : [button addTarget:self action:@selector(showCCView) forControlEvents:UIControlEventTouchUpInside]; Now that showCCView method is defined outside of loadView, where this above statement is locate...

Finding $(this) selected value in jQuery

Can't work this out... I've got a .change event handler for multiple select boxes. I need to find the selected value each time. I can't work out how to use .val with $(this). So here's my code: $(document).ready(function(){ $("select.className").change(function() { //console.log($(this).val); //console.log($("option:selec...

UIButton @selector not calling the method when clicked.

Here is my code: - (void)loadView { //hard coded array of content for each site // CC NSMutableArray *allccContent = [[NSMutableArray alloc] init]; NSString *cc1 = @"House Model"; NSString *cc2 = @"James Dexter History"; [allccContent addObject: cc1]; [cc1 release]; [allccContent addObject: cc2]; [cc2 release]; ...

Weirdest occurrence ever, UIButton @selector detecting right button, doing wrong 'else_if'?

So I dynamically create 3 UIButtons (for now), with this loop: NSMutableArray *sites = [[NSMutableArray alloc] init]; NSString *one = @"Constution Center"; NSString *two = @"Franklin Court"; NSString *three = @"Presidents House"; [sites addObject: one]; [one release]; [sites addObject: two]; [two re...

Getting elements children with certain tag jQuery

I'm trying to get all the input elements from a certain form from jQuery by providing only the name of the form and only knowing that those wanted fields are input elements. Let's say: <form action='#' id='formId'> <input id='name' /> <input id='surname'/> </form> How do I access them individually with jQuery? I tried something like ...

How to select all anchor tags with specific text

Given multiple anchor tags: <a class="myclass" href="...">My Text</a> How do I select the anchors matching the class and with some specific text. eg Select all anchors with the class:'myclass' and text:'My Text' ...

jquery file type selector

Hi, What is the correct jQuery syntax to only select certain file types? e.g. $("#fragment-1 a[SELECT ONLY ANCHOR TAGS WITH FILE TYPE OF MP3]").hide(); Thanks. ...

Jquery: How can I Get/Set html of a String Variable by using Jquery Selectors ?

Hi all. Firstly, sorry for my English (I'm from China). By reading this article(http://stackoverflow.com/questions/2421719/how-to-apply-jquery-element-selection-to-a-string-variable), I can successfully get Elements from a String which stores HTML text. For example: var htmlstr = "<div><ul><li>some text 1</li></ul></div><div><ul id=lis...

A problem with jQuery draggable with a selector handle

Hi, I have a problem where I have code like <table id="table"> <tr> <td>...</td> <tr> </tr> <td>...</td> </tr> <tr> <td>...</td> </tr> </table> and JavaScript such that $('#table').draggable(handle: '#table > tr:eq(0) > td:eq(0)'); but for some reason the entire table becomes the handle. It works when I set the td to have an ident...

jQuery :contains(unicode_characters)

I have an element like this: <span class="tool_tip" title="The full title">The ful&#8230;</span> This seems to work: jQuery('span:contains(…)'); But this does not: jQuery('span:contains(&#8230;)'); I am pretty sure that it would be bad to use the first one because if someone else saves the file, or the browser decides to get the...

Jquery recursive selector

Hi There, I have whole bunch of <div class="productlistname"><a href="#">The Text!</a></div>. What I want to do go through all .productlistname and truncate the text and replace the current text with the truncated version. Here is what I have so far: $(".productlistname a").html($(".productlistname a").html().substring(0,10)); This ...

Add event to all elements except the given with jQuery

Hey everyone I created a date picker that uses ajax to populate an element with an id of calendarContainer. When the user clicks on a button to bring the calendar up, I want the user to be able to click anywhere else on the screen besides the calendar and have it hide. The calendarContainer is at the root of the dom and I have tried eve...

how do I select a div with class "A" but NOT with class "B"?

I have some divs: <div class="A">"Target"</div> <div class="A B">"NotMyTarget"</div> <div class="A C">"NotMyTarget"</div> <div class="A D">"NotMyTarget"</div> <div class="A E">"NotMyTarget"</div> Is there a CSS selector that will get me the div containing Target but not the divs containing NotMyTarget? Solution must work on IE7, IE8,...

How to select text, but not images, in CSS

Simple question: I have the following markup... <a href='#'> <img src='icon.png'> This is the link </a> I want to have the text become underlined on mouseover. What is the CSS selector for selecting only the text in that <a> element and nothing else? I'd rather not wrap it in anything if I don't have to. a:hover { text-decoratio...

jQuery(selector) or $(selector), which one?

Hello Which is better way to use jQuery? I've heard that jQuery(element) doesn't ruin code in e.g. Wordpress. But $ is easier and faster to write. Which one do you prefer and why? Martti Laine ...

jQuery selectors with meta-characters

Hello Guys, I'm having problem selecting an element with an id like this <li ="0f:Bactidol_Recorder.mp4">. I tried using the function that escapes meta-characters with two backslashes below from this jquery link but still can't select the element Function: function jq(myid) { return '#' + myid.replace(/(:|\.)/g,'\\$1'); } Examp...

How to create a css rule for all elements except one class?!

Hi, I have created a CSS stylesheet for my project. Is there any way I can create a css rule that applies to all table elements EXCEPT table elements belonging to the class "dojoxGrid"? Something like: .not(dojoxGrid) table{ width:100%; border-top:1px solid #dddddd; border-left:1px solid #dddddd; border-right:1px solid ...