jquery-selectors

Getting the jQuery object/reference.

Here I'm wrapping an HTML tag with another tag '$holder' below. $holder = $('<div />') .addClass('joverlaytext') .css({ position:'relative', }); $(this).wrap($holder); Now after this statment how to get the object/reference to this newly created HTML element, ie. jQuery obj of '$holder' ...

jQuery wrap sets of elements in div

Hello I would like to use jQuery to wrap sets of elements in a div HTML: <h3>Title</h3> <ul> <li>Feature</li> <li>Feature</li> </ul> <h3>Title</h3> <ul> <li>Feature</li> <li>Feature</li> </ul> <h3>Title</h3> <ul> <li>Feature</li> <li>Feature</li> </ul> Desired Result: <div class="box"> <h3>Title</h3> <ul> <li>Feature</l...

jQuery using .this correctly

I have a page that has a number of weblog entries on it. Some of those entries have video associated with them. I would like to use jQuery Toggle the visibility of the videos (one at a time). My question relates to the use of .this so that I only toggle the desired video. My initial jQuery is: <script type="text/javascript"> $("#togg...

show/hide dropdown items based on previous dropdown selection

- - edited as i described it incorrectly first time round, sorry! - - Hi, i am trying to use show/hide to manipulate what is shown in a second dropdown menu, based on what is selected in the first dropdown menu. However after having it work briefly, it now doesn't across any browser, it just shows them all no matter what is selected. W...

jquery check class problem,

hello, I have a button that depending on a class value should send different values to the POST however what ever happens it is only running one condition, whatever I do I can only get it to send the POST the method=add data. This is my code $("a.navlink").click(function (ev) { $(this).removeClass("active"); var url = $(this).a...

2 jquery scripts aren't working together.

I've been working with these 2 Jquery files for a while, trying to debug them but I can't figure out why they don't work together. Any advice would be awesome and greatly appreciated. Thank you in advance! ========START JS#1===================== window.onerror=function(desc,page,line,chr){ /* alert('JavaScript error occurred! \n' ...

jQuery selectors and sIFR

I'm trying to use jQuery 1.3.1's :not selector with sIFR Ver. 3 Rev. 436. I've enabled the use of jQuery selector's as per the instructions at the sIFR Wiki, and basic selector's work which leads me to believe that sIFR is using the jQuery selectors. More advanced jQuery selector's are not, though. To enable jQuery selector's I remove...

How to toggle a class on child objects using JQuery

Hiya, I have the following markup <div class="question"> <h2>Title 1</h2> <div class="answer">content 1</div> </div> <div class="question"> <h2>Title 2</h2> <div class="answer">content 2</div> </div> <div class="question"> <h2>Title 3</h2> <div class="answer">content 3</div> </div> I want to toggle the class...

is there a jquery solution for removing an item from a select dropdown by display text

I see a number of examples of removing an item from a select dropdown by the items value ( such as this question ) but is there a way to remove an item from a select dropdown if all I know is the display text? ...

Using jQuery's Sizzle Engine to find a class (advanced)

What I am attempting to do is see if a jQuery object (or even DOM element for that matter) contains a particular class using the same selectors as the Sizzle engine. jQuery publicly exposes Sizzle with the following: jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.filters; jQuery.unique = Sizzle.uni...

Getting a jQuery selector for an element

In psuedo code, this is what I want. var selector = $(this).cssSelectorAsString(); // Made up method... // selector is now something like: "html>body>ul>li>img[3]" var element = $(selector); The reason is that I need to pass this off to an external environment, where a string is my only way to exchange data. This external environment...

jQuery Xpath selector to select an element which id contains 'sometext'

I have a listbox element in aspx page which id is attributesList. I want to select this element to track its change event, but i cant directly select its id because asp.net changes its id on runtime. its id, attributesList changes into ctl00_adminPlaceHolder_attributesList. so what i want to do is to use a "contains" xpath expression ...

Need an auto-complete multi-value selector like StackOverflow's "Interesting Tag" selector

I need a javascript control like the one used by stackoverflow for selecting/removing interesting and ignored tags. I really like the concept of creating little DIVs representing the item(s) you've selected, with an x to remove them. Where can I find a control like this? Did the creators of stackoverflow write this themselves? ...

need to get rel attribute and href attribute when making a while div clickable in jquery

Hey there, having some issues passing parameter values in jQuery. I need a div to open a link that opens as a Shadowbox dialog .. (Shadowbox uses the rel tag) i therefore need to get the value of both the href and rel, but cant' figure it out. i tried to just add .attr("rel") to the string but that didnt work. My jquery: $("div.banner"...

Select all inputs of a given form in Jquery

I have a form object in jquery, and I'd like to select all inputs of this form. Let's suppose my form object is called form. If the form has an id, I can just do var id = form.attr('id'); var inputs = $('#' + id + ' input'); If not I can check this, and then manually add a temporary id, do the selection, and remove the id (or just le...

Find and Hide element (jQuery)

<a href="#">Hide Me</a> How do I find a link with text "hide" in it. I know how to find links by attributes but can't figure out how to find link by its text. ...

:nth-of-type() in jQuery / Sizzle?

It surprised me that Sizzle (the selector engine jQuery uses) comes with a built-in :nth-child() selector, but lacks an :nth-of-type() selector. To illustrate the difference between :nth-child() and :nth-of-type() and to illustrate the problem, consider the following HTML document: <!doctype html> <html> <head> <meta charset="utf-8"...

JQUERY href disabling issue

Hi, I'm currently working on a home-made full front-office 100% javascript CMS of ours, and I'm having quite a problem. Some of the editable areas the user can edit are contained in href link. These href's are NOT editable, yet, when the user clicks on these zones (while in edition mode) browser follows these links. First, heres an exam...

jquery get array checkbox

I have in my document 2 checkbox arrays. One is engines[] and one is searchId[]. $("input:checkbox[@name='searchId[]']:checked").each(function() i use this to capture all the values from the searchId[] checkboxes (only if checked). $("input:checkbox[@name='engines[]']:checked").each(function() same thing for engines the problem is tha...

How to get parent of my element?

<div class="list_desc clearfix"> <div class="badge"> <div class="badgetop"> <p class="list_vote" id="l_val_1">20</p> <p class="list_vote_label">votes</p> </div> <div class="badgebottom" id="vl_1"> <div><a href="#+1"/>+1</a></div> <div><a href="#-1"/>-1</a></div> ...