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">
I have a simple jquery selector: $('[id^=total_item]') I would like to add a rule so that the upper code would match all elements that don't have 'locked' class (so that it wouldnt match those with class='locked'). How should I add this rule to the selector?
I want to load an html div in a variable, modify it in another variable; and then change the document injecting the contents.
1. I load the html to be changed in a variable (code) 2. I modify an attribute of <param> using attr() and I put the result in a var (newcode) 3. I change the html in the doc
I've used the debugger, and all steps give the expected results, except of newcode.html(), which is a null string. Why?
$('#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 get in both cases the same result, the expected elements are in my object, but in the second case, I get a Firebug warning saying "Unknown pseudo-calls or pseudo-element 'first'". This happens each time I am adding any :filter to any selector which uses more than one single expression. Does that mean that I should create my selectors as I did in the first case?
I am trying to use (multiple) attribute selector and I have a string variable "txt" that I need to use in the attribute selector to select all <p> with all id's except for the id=txt
I'm am trying to make a script that looks something like this:[code]This of course doesn't work. I don't no how to put the javascript variable v1 into the id selector to target the DIV with id="v1".I'm more a designer then a programmer.
im trying to figure out how to pass a target selector via a variablethe simple example below dosnt work, i was wondering why when i pass the varible target into the slector it does not work...
var target = "#1 .preview"; $(target).addClass("hidden");
I have a table where I hide a table row when the listen "item" is deleted. The item is deleted via jquery ajax. When the delete button is pressed, I call a plugin that creates a confirmation box. The plugin is passed a function to perform if 'Yes' is pressed.
[Code]...
The $(hideThis).hide(); line works. The tr is hidden from view. The next line is where I'm stuck. I know that how it is currently set up would never work, but looking at this will help you understand what I need to do. I want to edit the classes of all the tr tags that follow the one I just hid.
Here's the issue. I cannot just call the tr tag the same way I did to set the variable since I am no longer working in the same scope. And if I were to use this script the way it is written, the element it is looking for for the each statement is "[object] [object] ~ .lineItem".
How can I dynamically specify a class value to use in a selector? For instance, I have a number, and I need to identify an element that ends with that number. In this case, there are four divs that have class values of
my_id_0 my_id_1 my_id_2 my_id_3
I have a 0 (obtained previously in the code) stored in the value tabId, so I want to get the values of the class attribute for <div id="my_id_0">. How do I create my selector? I tried
I'm trying to define a selector as a global variable and it keeps coming back undefined. I tried creating a namespace for it but had no luck. I would like to be able to reference the sliderRange, currentMin, currentMax globally.
Why this works $("#test a:first[rel*='modal']").css("background-color", "red") And this does not!!! var testing='modal'; $("#test a:first[rel*=testing]").css("background-color", "red");
I'm trying to use a variable as part of a selector. When I insert the variable into the selector it doesn't work. But if I hardcode the variable into the selector it works fine. Here's an example:
Here's what I hope to be a quick question that I should be able to figure out myself... but, unfortunately, I can't...I'm trying to pass a variable into the attribute selector. When I substitute the "+myHref+" for "http", I get a match. When I log the myHref var, I get a match. What's wrong with my syntax? Why isn't the myLink finding a match?
I try to load specific text from a page into a string. When I'm on the specific page I can do this as follows: var wantedText = $("td > span[style='color: #00AA00; font-weight: bold;']").text();But I want to get this text from another webpage using AJAX, I tried using .load() as follows:
$('#somediv').load(Url+" td > span"); //this loads 3 spans into #somediv (including the one I need) $('#somediv').load(Url+" td > span[style='color: #00AA00; font-weight: bold;']"); //this does nothing I also tried loading the entire page into a string using .ajax() like this:
(There's a structural reason for accessing the child <p> tags, rather than just the parent <div>s. Some <p> tags in some<div>swill have previously had a style change applied: if the changes are now applied only to the parents, some children won't changeā¦ at least not till they're hidden).Anyway: this code doesn't work, doesn't generate a FF error message, and doesn't stop subsequent chained functions from operating. So it can't be far off; and the syntax$(cl + ' > p') works ok in another function.
I'm passing a variable to a selector. I have found a few resources and tried to implement them but they're just not working for me. I am trying to find href that match my variable and am working with the following:
var itemLink = /site/Mario-Kart..etc. $("a[href=" + itemLink + "]").......etc.
I receive an error "Uncaught Syntax Error unrecognized expression: [href=/site/Mario-Kart..etc. ]" I have been placing the quotes in different places to correct the syntax but to no avail. Also, this works with JQuery v1.44 and earlier but not after.