I have a UL list with hyperlinks in the LIs. When I click on the hyperlink, I want to go up the list, and get the html() within the first LI in the list. I have a ('a') click function that returns the hyperlink as $(this).
Now how do I get up to UL and down to LI? (It's actually more complicated because I really want to go up to a top level UL and down to a top level LI...but let's start here).
When I start with $(this) how can I integrate it into a selector? For example, I can supposedly do ("LI > UL > LI:first"), but can I do ("$(this) > LI > UL > LI :first") or do I do ($(this) "> LI > UL > LI:first") ?
I'm trying to find an example of a country selector (which also provides a state selector if USA is chosen) then you cvan select the city, any samples out there?
I'm trying to create a drop down menu which has several levels. When a level is clicked on, other expanded categories in that level should minimize simultaneously. The trouble I'm having is using a combination of selectors to say 'all divs which match this pattern but not this one'. I've had a look through the selectors API pages
i use it in a CMS. In my content page, when I insert a floating element, I use it to set the margin around element according to left or right float in this way:
I have a problem that I couldn't solve myself. I have 2 forms. name="form1" and name="form2" In each form, there's the same class names for rows. <tr class="draggable">
What I need to do, is to take the last draggable row in a certain form. $( tr_object + " tr.draggable:last" ) <- returns the last tr with class draggable in whole document. How do I limit It's view/search scope to one of the forms only?
this code works for me , but there is something wrong , every time the function loads (every 2.5 seconds )the html is loaded in row [0] cell[0] , and they are stacked above each other . what may be wrong there ?
code : var searchtable=document.getElementById("searchtable") var resultscount=0
I am using the contains selector for one element because I do not know the full ID. Since I only need the first element it finds should I be adding something to improve performance?
On our current project we had an very unexpierenced coworker which wroted an "a" tag as an jquery selector. to better understand what he did see the following working sample:
This works in Firefox but not in IE (of course not Yeah we know its wrong, but we dont find a reason for its working in firefox ! can someone explain why this can even work ?
$('#prov_1 .toggleEdit').click(function () { $('#prov_1 .editable').toggle(); }); When I click on the "toggleEdit" button under #prov_1, the .editable elements in #prov_1 appear/disappear. Now I want to do this for all prov_N. $('#prov_' + pid + ' .toggleEdit').click(function () { $('#prov_' + pid + ' .editable').toggle(); });
does not work. How do I extract or define N, the pid number?
I am trying to make a sliding panel if you click a button, the only problem is that there are more of this panels on the page. I can make the first one open, but I cant make the one opening wich has the id=id.
I'm trying to add some functionality to a existing application. I have no control over the input element ids. There are inputs I need to use that have $ in the id <input id='field1$0'>. Trying to use the id selector $('#field1$0') fails (result is undefined).Is this a bug or "by design" in qQuery?Is there a workaround, other than looping thru all inputs to find the ones I need?
I was developing a very simple application, just for training some Ajax. It works like that:
» I make a search using Ajax and it gives me a list with a lot of cities according to their state;
» After receiving the data, I can only manipulate the first DIV (that contains the city data).
The problem is that the city boxes (DIVs) has the same ID and, when the jQuery function is set (to send the address to an input that will make a search through Google Maps API), it only works for the first DIV. Then, if I search new cities, it works, but the same manner :(
Check out the screenshots:
[url]
[url]
[url]
[url]
So... I can only handle the first DIV among all the anothers, because they have the same ID. I have already tried the .each(), .unique(), creating an array...
ere is my problem : I want to select all the h2 in my #corps container, except those with a .post-title class.The following selector doesn't work with IE (from 6 to 9). No problem with Chrome, Firefox, Opera.#corps h2:not(#corps h2.post-title)The HTML:
i am creating a simple dynamic menu for my study with the following structure:
[Code]...
now i need to find the correct selector for the mouseout event, because now the submenu disappears if i am getting of the current element (this) of the mainmenu, but i only want it to disappear if it is not anymore over the submenu, or if the mouse goes over another element of the main menu.
I started with jQuery a few days ago and rushed into a principal question. Is it possible to use a selector on a result of a selction made before?
code example (which will not work at all, just try to make clear what I want to achieve):
$(".row").$(".idCell") // in the row result the class idCell is unique
Is it possible to to something like this at all and if yes, how is it done?
What I want exactly to do is that if the user double-clicks on a row I want to return the content of the first cell in order to load another form with data according the selected id.
btw, as a last resort I could manually scan the .html() output of $(.row) but I still believe, that the developers of jQuery thought about this problem and there is a more elegant way to accomplish the task.
I can use $('p#T1') to select the <p> tag with an id of 'T1'. How would I select that <p> tag if 'T1' were a string? In other words, I'm passing 'T1' into the following function: function displayitems (myItem) { // in this case myItem is 'T1' // I then need to 'select' the <p> tag with the 'T1' (myItem) id. }
<span id="more"> Did you know? <span>The milky way is round.</span> </span> Using $("#more span").css("border", "1px solid black");
will place a black border around "The milky way is round." If I change the <span> tags in the HTML to <div> tags and issue $("#more div").css("border", "1px solid black"); The same will happen. "The milky way is round" will be framed. However, if I change the <span> tags to <p> tags, as in
where can i find an example of how jQuery selects objects when using an id selector? i'm asking because i've been using a cross browser snippet to select objects and i was wondering if it's the right move to move from the snippet to jQuery. the snippet checks to see for availabe methods and depending on the one that works, it knows which browser the user is using and selects the object using that method. i also know jQuery is cross browser, so it's kinda implied, just wanna make sure.
I'm looking for a way to add or change a property value in a previously defined CSS class - not just HTML objects that have that class. Then if later objects are assigned with this class, the objects would inherit the properties of the updated class. For example, if I change the class "image" to add "display:none", and then add the "image" class to an object, it would be displayed or not displayed depending on how this was previously defined.
Basically I have a carousel, and when an item is hovered on, it's corresponding titles needs to show up below. I've managed to get a very inefficient version this working by repeating the function with the explicit id for the list item, but I'd like to get this working in a more automated fashion by assigning a variable that can be used with both the list item id and the paragraph id. I'm not sure if index() is the best way to go about this, or how to actually add the variable to the id's.
The HTML -- <div id="carousel_holder"> <ul id="carousel">