selectors

How can I find and hide the parents of elements with a given text content using jQuery?

In the example below, I'm trying to figure out how to hide the fieldset if the text within the tags = Groups <fieldset class=" collapsible"> <legend class="collapse-processed"><a href="#">Groups</a></legend> I tried this, but, it winds up hiding all the fieldsets, not just this one... $(this).find('legend').each( function() { if...

What is the best way to organize unobtrusive JavaScript across multiple pages?

I love jQuery but am running into a problem with larger site and multiple pages. My problem is that each page has unique requirements and I need to know the best way to tell jQuery which pages to activate certain things. For example, some forms need the Validator plug-in and some don't, some tables use DataTables plug-in and some don't...

Jquery odd/even question with prepend/append.

I am successfully using jquery odd/even selectors to create a "tiger striping" on a table. Then I added ability to add or deleted rows. However I have not been able to get striping to work properly on add/delete of row. It works for a an add/append, but not on add/prepend or delete. Here is summary of the code... $(document).ready(f...

how to get current row of input control like textbox within html table

i am getting all checkboxes that are in an html table using this code and i need to find the current row in the table from the current checkbox. var checkboxes = $("form :checkbox"); for (i = 0; i <= checkboxes.length; i++) { var checkbox = checkboxes[i]; ///need to get current r...

Is there a jquery select for multiple form elements?

i want to get back an array of all: hidden inputs text inputs select inputs checkboxes I see this page but it seems like you have to query for checkboxes seperately is there anyway to have one selector get everything in one array? ...

with jquery, how would i get get all hidden input within an html table "mytable" that has class= "updatable"

question in subject . . basically i see that i can do this to get all hidden elements var input = $(#mytable:hidden); but i can't seem to do something like this: var input = $(#mytable:hidden:input.updatable); is there a way to have multiple criteria in a selector ...

Jquery - selector, made of object and string, can it be done?

Hello, Assume that there is an object, passed as an argument to a function. the argument name is "obj". can it be concatenated as followed? $(obj + " .className")...... OR $(obj + "[name='obj_name'])...... Thanks. ...

jquery selector problem

From firebug: >>> $("form#commentform").serialize(); "username=&email=&comment=&verify=" >>> $("#commentform").serialize(); "" >>> $("form#commentform") [form#commentform] >>> $("#commentform") [div#commentform] >>> $("#commentform").length 1 This is really weird,form#commentform works,but #commentform doesn't,why? ...

CSS selector for "foo that contains bar"?

Is there a way to make a CSS Selector that matches the following? All OBJECT elements which have a PARAM element inside of them The selector OBJECT PARAM doesn't work, as it matches the PARAM, not the OBJECT. I'd like to apply { display:none } to the objects; it's useless to apply that to the PARAMs. (I'm aware I could pull thi...

JQuery: Get tag content excluding nested tags

I've got some HTML like the following: <span id="A">Text I'm interested in <span id="B">Other crap I don't care about</span> </span> I'm looking to get the text content of span "A" excluding any nested tags (i.e. the content of span "B" in the above example). I'm trying to get the text content, not the HTML content. Also, in my part...

How to run action on jQuery selected elements in certain order?

I have a HTML table like this: <table> <tr><td>X</td><td>X</td><td class='latest order1'>X</td><td class='latest order4'>X</td></tr> <tr><td>X</td><td>X</td><td class='latest order3'>X</td><td class='latest order2'>X</td></tr> <tr><td>X</td><td>X</td><td class='latest order6'>X</td><td class='latest order5'>X</td></tr> </table> Now...

JQUERY FIND:FIRST not finding the first Paragraph?

Goal, is to extract the content for the CKEDITOR Text Editor, and then only obtain the FIRST paragraph. For some reason the bellow isn't working... Ideas? Given the following JavaScript: var newTitle = CKEDITOR.instances.meeting_notes.getData(); newTitle = $(newTitle).find("p:first").text(); ...

JQuery Selectors: How to select item with specific class *and* id

Hi all, I'm trying to select an HTML element on my page that has a specific class and ID. Here's the tag: <div class="statusLight" id="green"></div> I tried this with no luck: $statusLight = $('.statusLight#green'); I know that I could simply say $statusLight = $('#green'); But I was trying to find a way to select it based on ...

jquery click event is firing multiple times when using class selector

here is my html <li><div class="myLink" id=1>A<div> <li><div class="myLink" id=2>b<div> <li><div class="myLink" id=3>c<div> <li><div class="myLink" id=4>d<div> <li><div class="myLink" id=5>d<div> <li><div class="myLink" id=6>e<div> <li><div class="myLink" id=7>d<div> <li><div class="myLink" id=8>g<div> i created a jquery event bind wi...

JQuery not behaving itself

Of course it's jQuery, and not my lack of understanding causing this issue, but just in case it is my incompetence, can someone please tell me how to return the text "Acme" within this tag? <div class="grid-56" id="1005" style="border:solid 1px lightgray;"> <div class="grid-20 bold"> <a href="#" class="id_select_company" id=...

Appending text to the end of class names to make it obvious jQuery is utilizing those classes

Hello everyone, While developing a design using jQuery I stumbled across a problem. How would I know, without having to look through the javascript, if jQuery isn't doing a selector on a class in my HTML? That is to say, if I wanted to change the class to something else, I have no way of knowing if that class is being used elsewhere s...

Remove a CLASS for all child elements

Given the following HTML: <div id="table-filters"> <ul> <li class="active">blah</li> <li>blah</li> <li>blah</li> <li>blah</li> </ul> </div> Using table-filters as the jQuery selector, how can I clear out the elements having CLASS=ACTIVE, no matter which LI it happens to be on? thanks ...

JQUERY, Returning the object that was clicked to add a Class

Given the following: <div id="table-filters"> <ul> <li class="active" onclick="myfunc();">blah</li> <li onclick="myfunc();">blah</li> <li onclick="myfunc();">blah</li> <li onclick="myfunc();">blah</li> </ul> </div> function myfunc() { // Activate the LI clicked $(this).addClass("active"); } I ...

Is there a work around for this jQuery bug?

$('> img[src="folderopen.gif"]',$scope) The above will fail,seems a bug of jQuery,is there a work around? This issue is found here: http://stackoverflow.com/questions/2062381/how-to-judge-whether-there-is-a-specific-child-haschildtestatttest-wi/2062390#2062390 EDiT I've just verified this will also fail: $scope.children( 'img[src=...

How to find an element using CSS2 Selector in Motoools and hide it?

Hello! How can i find this span element with class="rocon.rocon-br" in #conttile2 by Mootools' Css Selector? This element is created dynamically by Javascript (rounded corner), so this is what i see in Dragonfly Dom tree for it: html > body > div#wrapper.wrapper > div#penalties.container > h2#conttitle2.rc10.rocon__8.rocon-init > span....