im having a little trouble getting the background image to swap out on click()
$('.highlight-boxes li a[class!=selected-box]').click(function() {
$('.highlight-content').hide();
$('.highlight-boxes li a').removeClass();
$(this).addClass('box-selected'); // problem here
var selected = $(this).attr('h...
I have a multi-level lists like this:
<ul>
<li>Item 1
<ul>
<li>Item 1's 1st Child
<ul>
<li>Item 1's 1st Grandchild
<ul>
<li>Item 1's Grand Grandchild</li>
</ul>
</li>
...
I am trying to create a function to change the class on a series of 5 list elements depending on which has been clicked. The goal is to change the style of the element depending on which one is the current element.
I had tried something like this:
function addClass(obj)
{
obj.className="highlight";
}
and then added this to my elemen...
I'm using jQuery's addClass to add a class to an tab so when clicked it'll change the class so it's obvious the tab is highlighted.
My HTML
<div id="mainNav">
<ul>
<li id="LinktheBand" onclick="nav('theBand')">The Band</li>
<li id="linkTheMusic" onclick="nav('theMusic')">The Music</li>
My C...
How can I attach a class to the row I'm adding in the datatable, if not possible, how Can i Use fnRowCallback or fnDrawCallback to change the class.
Thanks for your help!
(Please be explicit)
oTable = $('#example').dataTable( {
"bJQueryUI": true,
"bSortClasses": false,
"sDom":'T<"clear">',
...
Please help me in this script, what is the problem?
I'd like to addClass "green" to the 5th li.hr in every ul containers in my site. Thanks.
$("ul li.hr").each(function() {
if ($(this).length = 5) {
$(this).addClass("green");
}
});
PS: if its possible with CSS only, tell me how please.
EDIT: the UL got mixed elements, like:
...
I have this script:
<script type="text/javascript">
$(function() {
$("a", "top_menu").addClass("ui-widget ui-state-default");
});
</script>
What I want to do, is apply those classes to all anchor tags of the next div:
<!-- Top menu -->
<div class="top_menu">
<a href="test">An anchor</a>
<a href="test1">Second Anchor</a>...
Im trying to use jQuery to add a different class for each Span element, using .next()
This is the javascript:
<script type="text/javascript">
$(function() {
$("a", "div.top_menu").addClass("ui-icons-custom");
$("span.ui-icon:first", "ul.top_menu_list").addClass("ui-icon-pencil")
.next().addClass("ui-ico...
For the following HTML:
<td class="width2 padLeft" id="loading_45"> </td>
the following JQuery:
$('#loading_45').addClass('loading');
With the following css definition:
td.loading
{
background-image:url("../images/icon_loading_circle.gif");
background-position:left center;
background-repeat:no-repeat;
height:...
Hi
I have a table, with rows which all have a cell of a div with a dynamically generated id in the format of btn-insertidhere.
When the table row is selected, I want to select this div id, then remove a class and change it to another one. This is down to me wanting to have a button image change from an add symbol to a delete symbol whi...
I have a list of objects called projects that are sortable, and a list of objects called categories that are droppable. I need to somehow make it so that when you click on a sortable project, and drag it down so it is hovering over a droppable category, the category that the project is going to go into is highlighted, or outlined or some...
Ideally I want to hover over my <li> in my menu and highlight each <li> but as a test I have the following to change the class on hover. Any thoughts why this won't work?
Thanks so much.
.dropdownhoverIn a:hover
{
background-color: White;
color: #39C;
}
<form id="form1" runat="server">
<div id="multiDropMenu">
...
This little search example works but only the first time.
How do I clear all the classes from the p elements so when searching the second time, the highlight from the previous search doesn't show?
<!DOCTYPE html>
<html>
<head>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="t...
I have an issue with jquery where elements are not found when the query string has '$' char in them -- is there a known issue? Unfortunately search engines make it so hard to searh for symbols in threads.
I have an html such as this:
<TD id="ctl00$m$g_cd3cd7fd_df51_4f95_9057_d98f0c1e1d60$ctl00$ctl00_5"
class="MenuItem"
onclick...
My application is trying to show a text watermark in a textbox on a form, but I don't want to touch the actual value of the box. So, I'm trying to use a background image with the watermark text, using classes;
.watermarkon input
{
background-image: url('../forms/images/TypeNameWatermark.png');
background-repeat:no...
Not a problem, but a question to upgrade my knowledge :
<script type="text/javascript">
$(document).ready(function(){
if (jQuery.browser.msie)
{
//If js is not active we couldn't launch html5 compat script.
//So we won't bother with conditionnal comments, slowing down engine rendering
...
Hi All,
I have a table (standard markup) with a radio select in each row. Once the radio is selected I'd like to highlight that . Sounds straight forward enough but I can't get it to trigger.
Here's the markup:
The Table Row:
<tr>
<td>some data</td>
<td>some data</td>
<td>some data</td>
<td>
<label class="label_radio"><input...
Suppose you have a table like this:
<table>
<tr>
<td>Group 1</td>
<td>some data here</td>
<td>Group 2</td>
</tr>
</table>
and you want it to be like this:
<table>
<tr>
<td class="group1">Group 1</td>
<td>some data here</td>
<td class="group2">Group 2</td>
</tr>
</table>
Both Nick Craver's and Kevin's solutions here below work nicel...
I have made a menu that gets subpages with ajax and it works as it
should.
And now I would like to add a class to the link that was clicked, so I
can display an active state on that link?
This is what I have:
$(document).ready(function(){
loadPage();
});
function loadPage(url) {
//loads the menu
$('#guiden...
I have a menu and each menu item is a span with a class set in css:
.newClass {color: red}
.oldClass {color:black} oldClass:hover {color:blue;}
When you click on a menu item the class is changed with:
$(this).removeClass('oldClass').addClass('newClass');
which works fine.
When another menuItem is click I change the classes back o...