These DIVS are full of information populated from a MSQL db. So the DIV names cannot be unique. I have this jQuery code:
[Code]....
This code actually works perfectly except for one major headache. When I click the 'hide/show' link on any of these - the only one that hides or shows is the first set. After research I feel like I'll need to use the .parent() selector or (this) somewhere but I feel like I've tried every combination.
I'm interested in getting an array of unique class names of all option tags under a specific select element. I'm imagining something like this (which does not do what I want): $ ( '#select_id option.class' ); What's the correct way to do this using jQuery?
I've got about 40 check-boxes on my 1 form. These check-boxes all have names (obviously) but they are NOT all unique names. The number of UNIQUE names on my form is probably around 8 or 9 (the actual number is NOT important). Because some check-boxes use the same names as other. It's set up this way, please don't ask me to change it, I can't change it.What's the syntax/method for looping through all the names? I was thinking I should do maybe a "for" loop;
for (var i = 0; i < fieldName.length; i++)
But I don't know how to hold a variable of the unique names to start with.
Let's say you have two elements, and you know their IDs; is there a way to select them both at the same time; something like $('#test #test2')?I realize I could just select them both on two different lines and apply the same function, or use class or something to track them down; but sometimes I just want to grab two elements by ID and do the same thing to them. I assume I'm just missing the syntax.
Are there limitation on what can be set for css styles? I have a script which sets a unique id but I wanted to turn user-select off for that item. I thought this would work: var id = 'wrapper_' +(new Date().getTime()); var wrapper = $('<div id='+id+'></div>' ); $(id).css({'-webkit-user-select: none;'});
The error I get is: Uncaught SyntaxError: Unexpected token }
Also, I was hoping to find a way to make the "check all" button become the "uncheck all" button if all things are already checked (and vice versa), but I won't push my luck.
I wasn't sure if this should be considered Javascript or HTML since I'm not really sure where the solution lies.
i have a mysql db which contains a table of car brand names and another table for car models (which is linked to the other).what i want is, to make a select box in HTML showing all the car brand names, when a brand name is highlighted it activates another select box that includes only the car models of the highlighted car brand...
This one is throwing me off! Either I am making a stupid mistake or I'm doing it totally wrong I have an array, and I am trying to select unique values from it and assign it to another array. Here is the code:
Code: var flag; for (i=0;i<=pdfs.length-1;i++) { flag = 1; for (j=0;j<=pdfs2.length-1;j++)
[Code]...
The problem is that the if (pdfs2[j] == pdfs[i]) statement ends up never being true. There are URL's to pdf files in the array. On the other side, if there is a much easier way to select unique values from an array, please feel free to point it out.
I expected $('#tabcontainers div') to return just the four top level divs but instead it returns six. That is, it is returning the four top level divs within tabcontainers but also the child divs with class="content" inside the top level divs.Is there a way to just select the 4 top level divs (i.e. excluding the inner divs) other than putting class or id attributes on them and using those in the selector?
I'm trying to update a script I found out there in order to fit better my needs. The first step I want to update is the capability to bind a dynamic number of anchors.
I am trying to figure out the syntax for the following. For this version I am simply trying to select the 2nd child of the SLIDE HOLDER div. For this test I am just making the width grow. My next pass will be to get the index of the DOT clicked and then pass it to the child of the other parent. Please see line 24. I know this is incorrect but placed it to give you an idea of what I am trying to accomplish.
I need to select the last children of parent elements
For example
<ul> <li></li> <-This will have the background #1a <li></li> <-This will have the background #1a <li><ul>
[Code]....
So I would need the last children. If there is no nested element then that is considered the last child. I have to write a jquery script to apply a background to the last children. A nested element can have a nested element and then that element's children will be considered the last ones so they will get the background but not the parents of those children. If the item has no children then that item will have a background.
So there are 3 different backgrounds. Each letter a, b c will represent a lighter tone compared to the previous color. C is lighter than B, B is lighter than A etc. So this will have to be a "smart" system in which the ul li will be updated and depending if it is the last one inhierarchyit will not have the arrow.
I have an iFrame on a page where I am calling .mouseup(function()) on it's document child.Once in the mouseup function, I need to refer to a specific sibling of the iFrame.Unfortunately, I cannot figure out how to traverse backwards to the iFrame element from $(this) - where $(this) is the document. I get a null set returned when I try$(this).parents().
I can select the parent of the current element if it (the parent) has a class named "class". How can I select parents that don't have a certain class? Also, how can I select parents that don't have more than one class? Does the .parent() method allow to do this?
I have an ajax dependent drop down set up for location fields and am having trouble figuring out how to clear the dependent selects if the parent select is changed to blank.I set up a function to clearFields:
<script> function clearFields() { document.getElementById('cb_state').value = "";
I have been trying to figure this out for a while, and I cant manage to get it working. I have a table for instance the one below: <tr> <td><input type='text' id='test_value[]' .... /></td> <td><input type='text' id='test_value2[]' .... /></td> <td><input type='text' id='date[]' onclick ="testfunc(this);" .... /></td> </tr>
Within my function I can grab the index of the onclick no problem, but when I select the date from the date picker, it always select the first column. testfunc(val) val.parentNode.parentNode.rowIndex I am using clone to create multiple instances of a row, but how can I use non-unique id (date[]) which all my X rows have the same name, to unique enter the datepicker value.
I am trying to loop through my top level nav i.e <ul> <li> and then apply that class name to teh sub level menu of that particular top level. So essentially the clas name on the top <li> wil be applied to its sub level items. Here is my code, which isn't working at the moment:
$(document).ready(function(){ var pageID = $('body').attr('id'); var uniquePageID uniquePageID =$("#site-nav ul li",this).attr('id');