JQuery :: Access The Current Item's Attributes?
May 12, 2011
$('td[id=opinionAxis]').html("<img src=images/"+this.attr("title")+".png>");
So essentially what I'm trying to is put an image inside all my td's that have "opinionAxis" as their id. The image has to be equal to the value in the title attribute in addition to the sub folder and file type. How do I access the current item's attributes?
View 2 Replies
ADVERTISEMENT
Feb 18, 2010
I need to access two attribute values I've assigned to each row in my table when a button is clicked.. I'm not sure how to access the attributes..
<tbody>
<tr attr1='something" attr2='somethingElse'>
<td></td>....
[code]....
View 1 Replies
View Related
Jun 6, 2011
I am currently making the first steps with jQuery and it went quite fine so far but now I am stuck. My servlet provides an ArrayList of java objects and I need to access some of the attributes of the objects.
So, there are 2 things which I don't know how to implement.
1. Iterate over the ArrayList
2. Access the attributes
View 9 Replies
View Related
Dec 27, 2011
I make use of new HTML5 data attributes to attach data to DOM elements like so:<div class="foo" data-randomdata="bar">jQuery is awesome.</div> It would be nice to have a specific method to accessing the attributes without having to use the .attr() method like this: var foo = $('div').attr('data-randomdata'); It would be nice for it to work something like this: var foo = $('div').DOMdata('randomdata'); //equals bar
View 1 Replies
View Related
Jul 9, 2009
Is it possible to target certain <li> in an unordered list by index with jQuery? I thought maybe I could use .index but was not able to get the syntax right. I thought maybe something like this would work but is has not:
$("#mycarousel > li").index(i).css("margin-right", "5px");
View 34 Replies
View Related
Jul 14, 2009
I am trying to find and get the current index in a group of elements like so:
var index = $(attribute).index(this);
However, this returns -1 for all selectors I pass to it in the variable. Why is this? Is there another way to find a div's position within its container easily?
View 2 Replies
View Related
Jan 10, 2012
I have an image gallery where every image has an index number ("data-index"). How do I access that index number when the image is "current" and then add +1 when it's "next" or subtract -1 when it's "previous"? Below is part of my code.
[Code]...
View 2 Replies
View Related
May 11, 2011
How would you access information about various attributes of an element with javascript?
View 2 Replies
View Related
Aug 16, 2011
I'm trying to get Superfish menus working on a new site I'm building, but have run into a problem. I have used the feature of setting a class on the current menu item so that it will be highlighted (highlit?). The trouble is that if the menu item has a submenu this submenu is displaying already opened when you hit the page.
I've set the menus up with the following options:
$('ul#nav').superfish({ hoverClass: 'sfHover',
pathClass: 'current',
pathLevels: 1,
delay: 800,
animation: {opacity:'show'},
speed: 'normal',
autoArrows: true,
dropShadows: true,
disableHI: false
});
This is a snippet of the menu code just for completeness, although it's pretty generic:
<ul id="nav">
<li><a href="index.html">Home</a></li>
<li class="current"><a href="agenda.html">Agenda</a>
<ul>
<li><a href="stream_busdev.html">Business Development Stream</a></li>
<li><a href="stream_techsupp.html">Technical and Support Stream</a></li>
<li><a href="stream_partners.html">Partners Stream</a></li>
<li><a href="stream_paytrain.html">Payroll and Training Stream</a></li>
</ul></li>
... more menu items in here ...
</ul>
I've also attached a screengrab, in case it helps, since the site isn't live yet. So I guess what I'm asking is: is there a way to have the current parent menu item marked as current without it automatically opening the submenu?
View 5 Replies
View Related
Jun 21, 2011
is it possible to access the index of the json data array in the current iteration and use it in a template?
View 2 Replies
View Related
Aug 28, 2009
I have this code which removes a class from an item on mouse out.
Code:
function mouseOut8( ) {
$('.bar8')
.removeClass("barover");
}
I would like to change this so that the class is removed from the item I have just moused out of instead of specifying the exact item. This is so I can use this function for multiple items. I tried replacing the '.bar8' with 'this' but it didn't work.
View 2 Replies
View Related
Feb 9, 2010
I've created the simple select box below that will "onchange" when an item is selected. I'm trying to apply the "selected" or "selected="selected" attribute to items that are chosen from the menu. Example: The goal is to show " <option value="/1" selected="selected"> " when page "/1" is chosen and to show <option value="/1"> when /1 is not the current page. I've follow a few simple tutorials with no luck and even tried php conditionals to trigger the "selected" attribute with no luck.
<form name="guideform" method="get">
<select class="wptdb_jumpbar_select" name="mymenu" onChange="window.location=document.guideform.mymenu.options[document.guideform.mymenu.selectedIndex].value">
<option value="/1">Home Page #1</option>
<option value="/2">Home Page #2</option>
<option value="/3">Home Page #3</option>
<option value="/4">Home Page #4</option>
</select>
</form>
View 4 Replies
View Related
Aug 6, 2011
I have a small script which adds a class to the current menu item selected.
Currently on the page load (this menu is within one page) the first menu item which is loaded does not have this .mywork_active class. Its not until you click it or another item that the class is added.
What would I need to do make the script add this class to the first item on load.
The menu looks like so:
View 1 Replies
View Related
Oct 8, 2010
i have a menu and i would like to change the color of the Categories which have subcategories only. In my example the basic categories are: News , Announcements , Contact and Career. Only Announcements and Career categories have subcategories. So i would like those two to turn green. The fact is that the list items include a href ,so i don't know how to access those "a href" combined with "this".
<ul id="my_menu">
<li id="id0"><a href="#" style="text-decoration:none">News</a></li>
<li id="id1"><a href="#" style="text-decoration:none">Announcements</a>
<ul>
[Code].....
View 3 Replies
View Related
May 11, 2010
$(document).ready(function(index){
$(connectSort).each(function(index, obj){
$("." + this).sortable({
connectWith: ".connectedSortable_" + this,
[Code]....
the first function(start: function ..) displays an attribute (title) of the dragged item once the sorting starts. supposedly, the second function (stop: function ..) would display the same attribute but of the item replaced by the dragged item once the sorting stops.
I have tried a lot of things already, but none seems to work.
View 2 Replies
View Related
Apr 7, 2010
I have some js code in which a click on a nav arrow causes list to be walked up or down and hilighted. Partial code is below. The problem is that when I get to the end of the list (e.g. there IS no next()), I want to skip this part of the code and actually hide the right arrow. I have no problem with the hiding part - I just want to set a flag when I have traversed the list to the last item.
[Code]...
View 4 Replies
View Related
Jun 16, 2011
i have a Drop down list with 10 choices (skillset). users must choose one skillset and the corresponding level (beginer/intermediate/master). ( they have to do this 10 times for all the sillsets) what i want is :
1 - i need to show up only one record (dropdowanlist) with level then have a button to add new skill and level if required 2- then when they choose the 1st skill from the dropdown , this one will not show up on the 2nd choice dropdown.
View 15 Replies
View Related
Aug 17, 2010
I'm using a jquery plugin called jplayer. I need to "bookmark" the current track.
The only way to know the current file playing is to look at the div called jplayer_playlist_current.
<li class="jplayer_playlist_current">
<a href="#" id="jplayer_playlist_item_1" class="jplayer_playlist_current">Introduction and guidance on usage</a></li>
What I want to get from it is the id, ie: jplayer_playlist_item_1
I thought that this might cover it:
[URL]
But nothing I do, no amount of googling or plugins, is getting me this result.
View 4 Replies
View Related
Mar 16, 2009
I'm trying to create two bookmarklets:
1. Take the current URL of the page and open a new window with a URL based on the current page. Some examples (I use "->" to mean "this URL turns into that URL"):I plan to use these bookmarklets in sequence, first pressing 1 to log into the CMS, then pressing 2 to edit the current page.
View 5 Replies
View Related
Sep 23, 2010
While trying out some of the code given in the book, I found that passing CSS properties and values in the jQuery is not working somehow. Following is what I have written.
$(document).ready(function() {
$('#first tbody tr:even').css('background-color': '#dddddd',
'color': '#666666',
'font-size': '11pt',
'line-height': '2.5em');
});
Where as if Ipass CSS properties infollowing way, it is working. But I would need to write multiple statements for that. $('#first tbody tr:even').css('color', '#873450');
View 2 Replies
View Related
Sep 6, 2011
If I have the following hyperlink :
<p><a href='page.htm' id='foo' class='bar' alt='alt text'>click</a></p>
I know that I can get (eg) the href attribute via $('a').attr('href') BUT I would like to do the following :
get *all* the attribute names and values without knowing anything about the attribute names and values in advance (or even how many there are) - something like a loop and $('a').(attribute name, attribute value). I suppose they would best be placed in a JavaScript object as a set of name/value pairs eg { href: 'page.htm', id: 'foo', alt: 'alt text' }
View 1 Replies
View Related
Apr 5, 2011
it has been a short time since i use jquery. I am now stuck on a problem with jquery- getting a xml node's all attributes as an array for example.. I have searched a lot on that with no luck Is there a way on getting all attributes of a node with jquery?
View 1 Replies
View Related
Jun 2, 2009
I am trying to get the color of an element and change the colorof another element with that color. Does this make sense?What is wrong with this? I would like all of the H1 tags to inherentthe color of ".ui-state-error".
$(function(){
var color = $('.ui-state-error').css('color');
$("H1").css({'color', ' + color + '});
[code]....
View 3 Replies
View Related
Aug 13, 2009
I need to be able to get the css attributes that a particular class defines. Such that if I have a class called "SomeClass" I want to see if it defines the attribute "position". I've tried using .css on an element that has the class, but of course that picks up the defaults and any inheritance.
View 2 Replies
View Related
Sep 28, 2009
If I have a tag image like this..
<span class="nodeLabelBox repTarget"><<span class="nodeTag">img</span><span
How to code this with jquery?
View 4 Replies
View Related
Aug 4, 2010
I have a suggestion based on the assumption, which I think is correct but feel free to prove me wrong, that the .attr() method returns "undefined" in two different cases:1) when the attribute is actually not present in the dom element2) when it is present but it has no value, think for example <input type="text" disabled/> which I not is not standard HTML but I've seen it pretty often...wouldn't it be better to return undefined only in the first case, and return null in the second case? In this way, it'd be clear that the attribute is set but no value is specified.
View 2 Replies
View Related