FAQ Database Discussion Community


jQuery if date true, change class of element x

javascript,jquery,table,addclass,removeclass
Thank you all for help! Now i have two more questions and have updated my code. I have this if (releaseDate <= today), why is the Date 15.05.2015 success?! When i want to check dates with time example: 25.04.2015 - 09.00 am, how i can check that with today and...

remove class on close from image positioned outside of parent

jquery,removeclass
on click of the close button I am trying to remove the class 'blur' from the an image positioned out side of the close buttons parent div. HTML... <div class="sixteen columns"> <!-- hover content --> <div class="imagesHoverContent"> <div class="hoverContentContainer"> <span class="close">close</span> <h2 class="entry-title">title</h2> <p>Lorem Ipsum is simply dummy text of...

jQuery .click() not working properly [duplicate]

javascript,jquery,html,addclass,removeclass
This question already has an answer here: Jquery click function is not working for dynamic elements 3 answers I have looked through a few of the other stackoverflow questions about the .click function not working but none of them seem to help me. I have my imports of the...

jQuery removeClass to disable on('click',function()

javascript,jquery,removeclass
as the title suggests, I have the following function: $('.breadCrumb').on('click',function(){ var bc = $(this).prop('id'); var id = bc.split('_'); $('#'+bc).removeClass("breadCrumb"); //$('.'+bc).show();//show spinner on specific id $.ajax({ url:'/ajax/breadcrumb/', data:{bc:id[1]} }).success(function(breadcrumb){ $('#'+bc).html(breadcrumb); //$('.spinner').hide(); }); }); The problem is, I am able to click again (for whatever reason) and I want to prevent someone...

jquery click event should stop when class is removed but it does not

javascript,jquery,click,removeclass
I have a link that I do not want to be clickable so I created the following code: <a class="not-allowed" id="new-user" href="users/new">New</a> <script> $('.not-allowed').click(false); </script> After some user action, I want the link to be clickable, So I use the following code: $('#new-user').removeClass("not-allowed"); The class "not-allowed" is succesfully removed, but...

JQuery element unaffected by click after removeClass/addClass

jquery,addclass,removeclass
Not sure how to explain this, but here's the JS fiddle. http://jsfiddle.net/1kLsoj6h/ If you click on anything, then back to "Dashboard", it's unaffected. I'm not sure why that's happening. Here's the code: $('#Dashboard').addClass('tabs_active').removeClass('tabs'); $('.tabs').click(function(){ $('.tabs_active').addClass('tabs').removeClass('tabs_active'); $(this).addClass('tabs_active').removeClass('tabs'); }); Here's the HTML for Dashboard <div id="Dashboard" class="tabs "> <i class="fa fa-tachometer fw"></i>...

jquery.RemoveClass - Removing class by not refering id

jquery,css,removeclass
I am looking for the quick fix for removing the class 'checked' in the lower most level. $('#bannerGeography tr td .allTR .option-group div.checkbox').RemoveClass('checked'); Did not seem to work. Can you please help...

Remove class on collapse (jquery)

javascript,jquery,toggle,collapse,removeclass
I tried looking for an answer, but none of it has solved my problem yet. I am a beginner in learning to understand this code language and I think that my problem lies there. I have created a JSFiddle with what I have up until now. (http://jsfiddle.net/fxmcb5yv/2/)! This is my...

Why is removeClass not working?

javascript,jquery,html,addclass,removeclass
I'm guessing this is really simple but it has been driving me insane! here is my jquery code below and here is my Fiddle $("#Headerhome").addClass('menuSelected').siblings().removeClass('menuSelected'); $('#Headerhome').children('#Site-icon-1').addClass('SiteIconHover').siblings().removeClass('SiteIconHover'); $("#HeaderSites").on('click', function () { $(this).addClass('menuSelected').siblings().removeClass('menuSelected'); $(this).children('#Site-icon-2').addClass('SiteIconHover2').siblings().removeClass('SiteIconHover2');...

Change class on click based on current class

jquery,click,font-awesome,addclass,removeclass
I want to take a simple FontAwesome icon: <div class="emotion"> <i class="fa fa-smile-o"></i> </div> and swap the class depending on what the current class is: $(".emotion .fa-smile-o").click(function (){ $(this).removeClass('fa-smile-o').addClass("fa-meh-o"); }); $(".emotion .fa-meh-o").click(function (){ $(this).removeClass('fa-meh-o').addClass("fa-frown-o"); }); $(".emotion .fa-frown-o").click(function (){ $(this).removeClass('fa-frown-o').addClass("fa-smile-o"); }); But currently this only works for the first class...

removeClass doesn't undo CSS effects

javascript,jquery,jsfiddle,removeclass
I have designed a script to show two different streams of realizations of random variables. Once the streams have been fully displayed, I would like to display two previously hidden buttons (which allows the user to select which stream had the higher average). My current method is to use CSS...

REMOVE Accordion Panel using Jquery

jquery,html,accordion,jquery-accordion,removeclass
While searching, I can mostly find how to add a panel using Jquery Accordion and got that to work no problem. BUT, how do I remove the same panel that I added? I have this fiddle:http://jsfiddle.net/cof7ojky/12/ working which adds a panel to the according. BUT now I want to REMOVE...

Problems with addclass and removeclass jsfiddle [closed]

jquery,css,iframe,addclass,removeclass
Im doing my first script for hide an iframe and show it with the jquery addclass and removeclass. I have this, but i have some problems loading some iframes. Can someone check for the js if it's correct? $(document).ready(function () { $("#dvc-aut").click(function () { $(".dvc-aut").removeClass("dvc-pho dvc-spp dvc-spl dvc-tap dvc-tal"); });...

How can I make an element not visible after refresh

javascript,jquery,refresh,removeclass
Basically I put a lightbox with a video in my website which shows at the beginning, you can skip it using a button or pressing "Esc" key, but what i want is it only shows once, I mean if I do a refresh on the site, or if I go...

jQuery removeClass doesn't works the right way

jquery,addclass,removeclass
There are two buttons (the black ones), and two (at the beginning small sized) green boxes with (red, but at beginning not showed) contents in them. My goal is to make working perfectly the following: If I click on the first button, the first box gets a bigger size, and...

jQuery toggleClass not working with bootstrap collapse (change Icon/Class)

jquery,addclass,collapse,removeclass,toggleclass
I'm working with bootstrap 3 and the collapse function. If I click on my plus-icon the collapse-panel will be shown. Another click and the panel will be close. Works! But I want to toggleClass my Icon .. onclick change to imgMinus (open collapse), click again, change to imgPlus (close collapse)....

removeClass setting display none

javascript,jquery,html,addclass,removeclass
html: <table> <tr> <td>Hi</td> <td><a href="#">Click me</a> </td> </tr> </table> js: $('td a').click(function (event) { var txt = $(this); event.preventDefault(); txt.closest('td').addClass('info'); txt.closest('td').fadeOut(500, function () { txt.closest('td').removeClass('info'); }); this.blur(); txt.parent().attr('style', 'display: inherit;'); return false; }); https://jsfiddle.net/iScripters/0dpLyv96/4/ When you click 'Click me', I want the class 'info' to be added to the...

jQuery remove class from parent on click

jquery,click,parent-child,addclass,removeclass
I have an element that once you click on it, it adds and removes a class with jQuery. When you click on a child element I want the classes to swap again. I tried doing it with .parent but that doesn't seem to work.. This is the html: <article class="block...

Jquery replace class only works one way

jquery,class,addclass,removeclass
For a school project i'm making a social media page and i've come to the point I have to make a follow/unfollow button. I've made 2 classes. One class (class1) that looks like a normal button and one (class2) that looks like that button is pressed. Normally class1 is chosen...

Isolating add/remove class to clicked item

javascript,jquery,addclass,removeclass,toggleclass
Currently I have a accordion menu, each time .responsive-accordion-head is clicked I'm telling it to switch classes as follows: $('.responsive-accordion-head').click(function () { if ( $( '.responsive-accordion-head i' ).hasClass( "plus-2" ) ) { $('.responsive-accordion-head i').removeClass("plus-2"); $('.responsive-accordion-head i').addClass("minus-2"); } else { $('.responsive-accordion-head i').removeClass("minus-2"); $('.responsive-accordion-head i').addClass("plus-2"); } }); The problem I have is...