jquery-selectors

Div's are not filtered as :hidden when display:none; is appended as style

Hey folks I have some simple HTML: <div id="selectorContainer"> <div id="chainedSelector" style="display: none;"><% Html.RenderPartial("ProjectSuggest/ChainedProjectSelector"); %></div> <div id="suggestSelector"><% Html.RenderPartial("ProjectSuggest/SuggestControl", new SuggestModeDTO{RegistrationMode = Model.RegistrationMode})...

Jquery plugin tools for maps

Can any one suggest a link or an example to create an atlas like tool using jquery What does google maps use? Thanks.. ...

Abstracting the adding of click events to elements selected by class using jQuery

I'm slowly getting up to speed with jQuery and am starting to want to abstract my code. I'm running into problems trying to define click events at page load. In the code below, I'm trying to run through each div with the 'block' class and add events to some of its child elements by selecting them by class: <script language="javascript"...

JQuery selector: pass on id from array into function

I have a list of items <div id="item1">somestuff</div> <div id="item2">somestuff</div> <div id="item3">somestuff</div> When someone clicks on one of these, I need to take some actions based on the id (the number). Let's say hide it. How can I make the function generic, and how can I pass the id into the function? $(document).ready(f...

Get the selected option id with jQuery

Hi, I'm trying to use jQuery to make an ajax request based on a selected option. Is there a simple way to retrieve the selected option id (e.g. "id2") using jQuery? <select id="my_select"> <option value="o1" id="id1">Option1</option> <option value="o2" id="id2">Option2</option> </select> $("#my_select").change(function() { ...

jquery data selector

I need to select elements based on values stored in an element's .data() object. At a minimum, I'd like to select top-level data properties using selectors, perhaps like this: $('a').data("category","music"); $('a:data(category=music)'); Or perhaps the selector would be in regular attribute selector format: $('a[category=music]'); ...

jquery selector question: do something only if all elements are hidden

I need to do something only if all the li's in a given ul are hidden.. this doesn't seem to do the trick. is there a way? if ($('#some_ul li:hidden')) { // do something only if all 'li's in a given ul are hidden } ...

best way to filter out non-representational elements

Hi there, I am using phpQuery in order to apply some twaks to editorial content. As its syntax is the same as jQuery, I consider this a dom scripting issue. To get rid of elements which are not representing anything, but wrapping other stuff (like the div in <div><p>blah</p></div> I came up with this selector: $doc['div:not([alig...

Not able to get siblings value from table row

Hi All, I am trying to get values from adjacent columns, when a radio button is clicked for that row. I'm able to do so, but the problem I'm facing, when there are more elements in the radio button column, then i am getting null values(i.e 2nd row is not working). Please help...Code is all follows <table id="dist_list" class="data"> <t...

Finding all LIs that have name="checked"

I'm trying to find all LIs with name=checked and hide() them, but this doesn't seem to be working: $('li').attr("name","checked").hide(); <li name="unchecked" style="display: inline;"><a href="/">Home</a></li> Any ideas? ...

How to match "input" and "select" elements in jQuery with 1 query

re, I have a simple query that works: $("#test > fieldset > input").each(function() { }) However, I want to select "input" and "select" elements without having to write 2 "each" queries. Is this possible? thanks. ...

jquery selector logical AND?

In jQuery I'm trying to select only mount nodes where a and b's text values are 64 and "test" accordingly. I'd also like to fallback to 32 if no 64 and "test" exist. What I'm seeing with the code below though, is that the 32 mount is being returned instead of the 64. The XML: <thingses> <thing> <a>32</a> <-- note, a here i...

Help with manipulating child/parent elements with jQuery

Currently I have this JQuery script var img = $(this); img.wrap('<div class="photo"></div>'); img.parent().append("<p>" + img.attr("alt") + "</p>"); which successfully turns the following: <img src="photo.jpg" alt="caption"> into this <div class="photo"> <img src="photos.jpg" alt="caption"/> <p>caption</p> </div...

JQuery, Selecting every img in the n'th div with a specific class

Something like $('.mydiv' :eq(n) 'img') but yeah that is a terrible way of writing it ah, help? ...

Idiomatic jQuery and selector paths in functions

What is the best way to write this function ontop of jQuery. Background: I'm working on a legacy web app that has lots of issues. It requires us to insert a IFrame to take care of a few "screens". Later this code will be refactored out but for now we need this. function openIframePage(selectorPath, url) { if ($(selectorPath).leng...

jquery selector to count the number of visible table rows?

I've got this html: <table> <tr style="display:table-row"><td>blah</td></tr> <tr style="display:none"><td>blah</td></tr> <tr style="display:none"><td>blah</td></tr> <tr style="display:table-row"><td>blah</td></tr> <tr style="display:table-row"><td>blah</td></tr> </table> I need to count the number of rows that don'...

jquery selector

hello, i have the below sample code for a navigation list: <div id="menu"> <ul> <li><a href="#sect1">link 1</a></li> <li><a href="#sect2">link 2</a></li> <li><a href="#sect3">link 3</a></li> </ul> </div> and some jquery code: $("#menu li").click(function () { var mylicontent=$(this).html(); }); i want to get both html conte...

How do I select all of the elements in a list that have children, using jQuery?

I have an arbitrarily deep list, like so: <ul> <li></li> <li> <ul> <li></li> <li> <ul> <li></li> <li></li> </ul> </li> </ul> </li> Using jQuery, how can I select every li in the list that is not a leaf node. In other words, I want to select all of the li elements that have children ULs. Th...

Is this the best way to query an element and its children?

I'm trying to query an element and its children to find ID's that begin with a particular string. var foundIDs = containerElement.find('[id^=something]').andSelf().filter('id^=something'); The find() method only searches descendants so I thought I'd try andSelf(). However, andSelf() does not take a selector. This means that the cont...

selecting href not starting with http

using jQuery i am trying to find out all the URLS that user has entered which are not starting with http or https and finally i want to prepend http to all such URLs so that when user clicks on them they are taken to a proper site instead of broken link caused due to entry of URLs without http or https. Also like to mention that User h...