Search Results

Search found 668 results on 27 pages for 'addclass'.

Page 17/27 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • jQuery: exclude class on click

    - by Kevin Brown
    //Table select $("#reports-table tr").click( function() { var detail_id = $(this).attr('id'); $(this).addClass("selected"); $(this).siblings().removeClass("selected"); $('#reports-right').show().load('/members/details/'+detail_id); $('#reports-table').width(680); } ); I currently am using this code to add a selected class to a table row and show details of the row clicked in a right 'aside'. The problem is, I have action buttons in the row--when they are clicked, becausee they are children of the tr, this function still runs... How can I exclude a certain class?

    Read the article

  • Jquery Validation Central Message Many Errors

    - by Iamjon
    Hi everyone, I have a form that is being valdated with the Jquery Validation Plugin. I have managed to get a centeral message "Please Recheck the form", and to have the input focus on the first error. To get this, I had to override the default message of each of the errors. I was wondering if anyone could help me figure out how I can have it display the error message associated with the first error input instead of a general error message. Here is the code: $("#Help-A-Noobie-Form" ).validate({ invalidHandler: function(form, validator) { $(this).find(":input.error:first").focus(); var message = 'Please Recheck The Form' ; $("#Help-A-Noobie-Form #Message p").addClass('red').html(message); }, showErrors: function(errorMap, errorList) { this.defaultShowErrors(); }, rules: { required:true, email: {email:true}, phone: {digits:true} }, messages: { email: "", phone: "", lastname: "", firstname: "", required:"" } })

    Read the article

  • jQuery: I need something like ':visible' that works even if the parent is display=none

    - by Master Morality
    I have a list where elements are hidden for multiple reasons, each corresponding to a css class i.e: <style> .filteredOut { display: none; } .somethingElse { display : none; } ... </style> I want to apply alternating css classes via .filter(':even').addClass('even') but only to classes that are visible. The problem is that the parent is hidden when this happens so .filter(':visible') returns 0 elements. I need something like .filter(':visibileEventIfParentIsNot') Further more, I'd rather not have to call a function with this in it every time I call a function that changes what's visible in a list. This may be a pipe dream, but is there a way to do this ala live() or something similar? I'm open to off the wall ideas.

    Read the article

  • Highlight current page in jquery

    - by 3gwebtrain
    Hi, I have the 12 html pages. and all this pages are loads when the left navigation bar link clicked. in this, i need to add a class to the current link, which is clicked and loaded the page. i tried with this: $(function(){ $('#container li a').click(function(){ $('#container li a').removeClass('current'); var pathname = (window.location.pathname.match(/[^\/]+$/)[0]); var currentPage = $(this).attr('href'); if(currentPage==pathname){ $(this).addClass('current'); } else{ alert('wrong'); } // alert(pathname+' currentPage: '+currentPage); }) }) it works, but on page load, the class is removed, i don't know why it's happening.. any help?

    Read the article

  • How to use 'this' in jQuery plugin callback?

    - by Bondye
    At the moment I am creating a jQuery plugin. I am facing a problem when using a callback. Plugin code $.fn.bondye = function (options) { var settings = $.extend({ callback: function () {} }, options); return this.each(function () { $(this).addClass('test'); settings.callback(); }); }; How I want to execute the code $(".myDiv").bondye({ callback: function () { $(this).removeClass("test"); } }); jsFiddle example: http://jsfiddle.net/HEJtm/1/ But I aint able to do anything with the div within the callback. I used http://learn.jquery.com/plugins/advanced-plugin-concepts/ to learn developing jQuery plugins, but I cannot find anything about callbacks.

    Read the article

  • Javascript looping only through defined properties of array. How?

    - by Beck
    For example if i'm keeping array of references via id like that: if(typeof channel_boards[misc.channel_id] == 'undefined') { channel_boards[misc.channel_id] = $('<div class="channel" channel_id="'+misc.channel_id+'"></div>').appendTo('#board'); } And then i'm looping through array to find required reference. I'm looping through undefined properties as well. Is it possible to loop only through defined properties? for(i=0;i<channel_boards.length;i++) { if(channel_boards[i] != undefined) { if(channel_boards[i].attr('channel_id') != visible) {channel_boards[i].addClass('hidden_board');} else {channel_boards[i].removeClass('hidden_board');} } } Maybe i should change the way i'm storing references? Via object for example, but how i'll be able to find proper reference via id number.

    Read the article

  • Deselecting an element in jQuery

    - by Michael Itzoe
    I have a collection of span elements. In the code I have a global variable that represents the "selected" object. Using the click event when a span is clicked I reset the object's class, reset the global variable, then set the object to the variable and change its class (to make it "highlighted"). This effectively toggles selection when clicking an object. var currentItem = null; $( ".item" ).click( function() { if( $( this ).hasClass( "selected" ) ) { $( this ).removeClass( "selected" ) currentItem = null; } else { if( $( ".item" ).hasClass( "selected" ) ){ $( ".item" ).removeClass( "selected" ) } $( this ).addClass( "selected" ); currentItem = $( this ); } } ); What I'd like to be able to do is unselect when clicking on an empty area of the page. I tried creating a click event on the body object, but that overrode the span click event so nothing was selected. I'm a complete jQuery noob and not sure where to go with this.

    Read the article

  • how to submit using link with my current code(php+jquery+ajax)

    - by ruslyrossi
    My current Code : <script type="text/javascript"> $(document).ready(function() { $('#form').ajaxForm( { target: '#preview', success: function() { $('#success_box').addClass('success') setTimeout(function() { $('#success_box').fadeOut('slow'); }, 3100); // <-- time in milliseconds } }); }); </script> <form action="controller/product_edit_update.php" method="post" id="form" name="form" > bla..bla.. <input type="submit" value="Save" /></form> but now i want to add submit link with <a href="" id="submit_with_link" >Save</a>

    Read the article

  • jquery - How do i call the same function with different div ids?

    - by Nahom
    Hi, I have two divs with different ids (#washing,#bleaching). How can i use a function for different id's. I have tried adding both the ids together $("#washing, #bleaching"), but the function is not working correctly on the divs. Can anyone please help me... Here is the code $(function() { $("#washing").paginate({ count: 10, start: 1, display: 7, border: true, border_color: '#fff', onChange: function(page) { $('._current', '#paginationdemo').removeClass('_current').hide(); $('#p' + page).addClass('_current').show(); } }); });

    Read the article

  • jQuery: Apply css to image on click event

    - by DasRakel
    I want basically the same as http://stackoverflow.com/questions/530701/jquery-select-image a row of images that you can select one of. But I'm trying to style the one I select, and store it. var selectedicon = ""; function selecticon(){ $('#iconselect').children().click(function(){ $(".selectedicon").removeclass("selectedicon"); selectedicon = $(this).attr("src"); $(this).addclass("selectedicon"); }); } on this <div id="iconselect"> <img src="/red-dot.png" class="selectedicon" /> <img src="/green-dot.png" /> <img src="/blue-dot.png" /> <img src="/orange-dot.png" /> </div> What am I doing wrong?

    Read the article

  • Changing cell class on radio button change

    - by Nick
    Huge thanks for the help in this thread - Click td, select radio button in jQuery But now I'm having trouble that it won't change the class of the cell, even though I have binded the 'change' trigger in jQuery like so: $("td input[type=radio]").bind('change click', function () { $('td').removeClass('selected'); $(this).parent('td').addClass('selected'); }); $("td").click(function () { $('input:radio', this).attr('checked', true); }); Hope that makes sense. If you click the radio button, or move between them using the keyboard, the cell's class changes just fine. However if you trigger this by clicking the cell it doesn't change the class :( Thanks

    Read the article

  • Use jQuery to match variable text?

    - by VUELA
    Hello! I have a sidebar navigation that lists blog entry titles down the side of the page. I am trying to write some jquery that will check the text in the title of the current full blog entry page and match it with the corresponding title in the sidebar navigation so that I can apply a class to style for an active state link ... but I'm not quite getting it! Here is the link to an example page: http://ncw-commercial.com/property-listings/eastpoint-plaza-lot.html, and below is my current code. I have also tried using :contains but could not figure out how to get that to work with a variable rather than direct text. $('.single-journal-entry-wrapper .journal-entry .title').each(function(){ var activeTitle = $(this).text(); $(".feedburnerFeedBlock .headline a").filter(function(index) { return $(this).text() == "activeTitle"; }).parent().addClass("activeTitle"); });

    Read the article

  • add navigation buttons with highlight to jQuery Cycle

    - by JJ Nold
    I am currently using jQuery cycle to display featured projects. I currently have the next and prev buttons setup, I also have four rounded buttons in between. I would like them to function as both a link to the corresponding slide as well as add a class to the button who's slide is currently active. I have the nav setup and the active class setup I just need the jQuery. You can see the code at http://jjnold.com/dev in the main slider at the top. I was thinking it's probably something like this to assign the class but I'm not sure how to link to the corresponding slide and have them work together. Any help is greatly appreciated. $('.featuredNavInt a').click(function() { $('.featuredNavInt a').removeClass('active'); $(this).addClass('active'); });

    Read the article

  • jQuery - Programmatically Trigger Event

    - by Sonny
    I need to programmatically trigger a click event that's being handled by jQuery. Here's the current code: var $thumbs = $('#PhotoGalleryThumbs .tile'); var $zoom = $('#PhotoGallery #PhotoGalleryZoom img'); var $description = $('#PhotoGallery #PhotoGalleryDescription'); $thumbs.click(function(event) { event.preventDefault(); var $thumb = $(this); $thumb.addClass('selected') .siblings().removeClass('selected'); $zoom.attr('src', $thumb.children('a').attr('href')); $description.html($thumb.find('img').attr('alt')); }); I am having a mental block working out how to create a function out of the event handling code and then arbitrarily calling it for an element in the $thumbs object.

    Read the article

  • Jquery to slide on load

    - by Pexsol
    I have a simple slider that works on click. How can I automate it so it runs automatically yet keeping the click function as it is? $(document).ready(function() { var currentPosition = 0; var slideHeight = 360; var slides = $('.main-item'); var numberOfSlides = slides.length; var tracker = 0; $('.slider-height').css('height', slideHeight * numberOfSlides); $('.slide-option li a').click(function() { tracker = $('.slide-option li a').index($(this)); $('.slide-option li a').removeClass('current-item'); $(this).addClass('current-item'); //alert(tracker); $('.slider-height').animate({ 'top': slideHeight * (-tracker) }); return false; //alert(tracker); }); });

    Read the article

  • If element has been 'mouseover'ed for 500ms, run function with jQuery

    - by PaulAdamDavis
    For the sanity of my users, I want a 'mouseover' event to run after the selector has been hovered for half a second rather than as soon as they hover it. I first tried a setTimeout function but that runs however long the element has been hovered, I didn't think it through too much I guess. I've also spent a day (on and off) searching (and playing Pacman) ti no result, unless I'm searching for the wrong things. I would like to keep this plugin-less if we can, purely for run speed & maintainability. $("#mySelector").mouseover(function(){ // Run after 500ms $(this).addClass("hasBeen500ms"); }); Let's see if we can crack this, I know it will have so many applications!

    Read the article

  • jQuery: Fade not working

    - by Rosarch
    For some reason, jQuery's fade effect isn't working. Could it be because of the code? This function does everything it is supposed to, aside from the fading. It gets called at the correct time. function moveToTerm(original_course, helper, term) { var cloned_course = original_course.clone(true); original_course.addClass('already-scheduled'); helper.fadeOut(function() { cloned_course.appendTo(term).attr('style', '').fadeIn("slow"); }); } UPDATE: It fails in both FF 3.5.9 and IE 8.

    Read the article

  • JQuery tab Selection problem?

    - by PeAk
    New to JQuery and I was wondering how do I keep any tabbed selected when a user reloads the web page? What part of my code do I need to change? Here is my JQuery code. $(document).ready(function() { //When page loads... $(".form-content").hide(); //Hide all content var firstMenu = $("#home-menu ul li:first"); firstMenu.show(); firstMenu.find("a").addClass("selected-link"); //Activate first tab $(".form-content:first").show(); //Show first tab content //On Click Event $("#home-menu ul li").click(function() { $("#home-menu ul li a").removeClass("selected-link"); //Remove any "selected-link" class $(this).find("a").addClass("selected-link"); //Add "selected-link" class to selected tab $(".form-content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the selected-link tab + content $(activeTab).fadeIn(); //Fade in the selected-link ID content return false; }); }); Here is the XHTML code. <div id="home-menu"> <ul> <li><a href="#personal-info-form" title="Personal Info Form Link">Personal Info</a></li> <li><a href="#contact-info-form" title="Contact Info Form Link">Contact Info</a></li> </ul> </div> <div> <div id="personal-info-form" class="form-content"> <h2>Personal Information</h2> <form method="post" action="index.php"> <fieldset> <ul> <li><label for="first_name">First Name: </label><input type="text" name="first_name" id="first_name" size="25" class="input-size" value="<?php if(!empty($first_name)){ echo $first_name; } ?>" /></li> <li><label for="middle_name">Middle Name: </label><input type="text" name="middle_name" id="middle_name" size="25" class="input-size" value="<?php if(!empty($middle_name)){ echo $middle_name; } ?>" /></li> <li><label for="last_name">Last Name: </label><input type="text" name="last_name" id="last_name" size="25" class="input-size" value="<?php if(!empty($last_name)){ echo $last_name; } ?>" /></li> <li><label for="password-1">Password: </label><input type="password" name="password1" id="password-1" size="25" class="input-size" /></li> <li><label for="password-2">Confirm Password: </label><input type="password" name="password2" id="password-2" size="25" class="input-size" /></li> <li><input type="submit" name="submit" value="Save Changes" class="save-button" /> <input type="submit" name="submit" value="Preview Changes" class="preview-changes-button" /></li> </ul> </fieldset> </form> </div> <div id="contact-info-form" class="form-content"> <h2>Contact Information</h2> <form method="post" action="index.php" id="contact-form"> <fieldset> <ul> <li><label for="address">Address 1: </label><input type="text" name="address" id="address" size="25" class="input-size" value="<?php if (isset($_POST['address'])) { echo $_POST['address']; } else if(!empty($address)) { echo $address; } ?>" /></li> <li><label for="address_two">Address 2: </label><input type="text" name="address_two" id="address_two" size="25" class="input-size" value="<?php if (isset($_POST['address_two'])) { echo $_POST['address_two']; } else if(!empty($address_two)) { echo $address_two; } ?>" /></li> <li><label for="city_town">City/Town: </label><input type="text" name="city_town" id="city_town" size="25" class="input-size" value="<?php if (isset($_POST['city_town'])) { echo $_POST['city_town']; } else if(!empty($city_town)) { echo $city_town; } ?>" /></li> <li><input type="submit" name="submit" value="Save Changes" class="save-button" /> <input type="hidden" name="contact_info_submitted" value="true" /> <input type="submit" name="submit" value="Preview Changes" class="preview-changes-button" /></li> </ul> </fieldset> </form> </div> </div>

    Read the article

  • Advantages Of Putting HTML in Javascript

    - by user1609376
    I am wondering if it is better to put your html in javascript or in your html files. For example having my js file have this $('<div>').addClass('test').append( $('<p>').text('test1'), $('<span>').text('test2'), $('<span>').text('test3') ).insertAfter( $('#test1') ); VS My html file looking like this <div id="#test1"></div> <div class="test"> <p>test1</p> <span>test2</span> <span>test3</span> </div> and the js file have: $('.test').show();

    Read the article

  • Simple accordion menu (jQuery)

    - by Nimbuz
    // ACCORDION $('.accordion .answer').hide(); // hide all $('.accordion .question').click(function(){ $('.accordion .answer').slideUp(); // hide all open $(this).addClass('active').next().slideDown(); // show the anwser return false; }); HTML: <dl class="accordion"> <dt class="question">question</dt> <dd class="answer">answer</dd> <dt class="question">question</dt> <dd class="answer">answer</dd> </dl> ... works, but the 'active' class is removed from inactive question elements and atleast one of the answer remains open, all answers should be able to close. Thanks!

    Read the article

  • multiple jquery galleries

    - by user1644650
    I'm trying to separate two jQuery galleries, so they don't interlink on my html page: http://mashanova.com/myFAQ/faqGallery.html# here is the html: here is javascript: $(document).ready(function(){ $('.gallery_thumbnails a').click(function(e){ e.preventDefault(); $('.gallery_thumbnails a').removeClass('selected'); $('.gallery_thumbnails a').children().css('opacity','1'); $(this).addClass('selected'); $(this).children().css('opacity','.4'); var photo_fullsize = $(this).attr('href'); var photo_preveiw = photo_fullsize.replace('fullsize','preview'); $('.gallery_preview').html('<a href="'+photo_fullsize+'" style="background-image:url('+photo_preveiw+');"></a>'); }); });

    Read the article

  • Highlight curret page in jquery

    - by 3gwebtrain
    Hi, I have the 12 html pages. and all this pages are loads when the left navigation bar link clicked. in this, i need to add a class to the current link, which is clicked and loaded the page. i tried with this: $(function(){ $('#container li a').click(function(){ $('#container li a').removeClass('current'); var pathname = (window.location.pathname.match(/[^\/]+$/)[0]); var currentPage = $(this).attr('href'); if(currentPage==pathname){ $(this).addClass('current'); } else{ alert('wrong'); } // alert(pathname+' currentPage: '+currentPage); }) }) it works, but on page load, the class is removed, i don't know why it's happening.. any help?

    Read the article

  • jQuery can't get if statement to work

    - by jstacks
    I'm looking help with an If Statement. I'm trying to finalize this horizontal scrolling I have and the last bit is to not just disable scrolling when the end is reached, but to also disable (well, change color) the scroll buttons at that point as well. And change back when they are scrollable again. http://jsfiddle.net/stfzy/83/ EDIT* I've updated the JQuery and have everything working except just one if statement: $('div#arrowL').click(function(){ if(index < 0 ){ //can't scroll $('div#arrowL').addClass('active'); } }); I need to add this class back when you can't scroll left anymore. And I think the issue is with the "index < 0" portion but I don't see what I need to change it to to get it to work. Any help is appreciated.

    Read the article

  • Fading between two classes in jquery

    - by Andy
    I would like to be able to fadeout this class <h2 class="care-home-fees"><a title="Care Home Fees" href="#">Text</a></h2> and fade in this <h2 class="care-home-fees-over"><a title="Care Home Fees" href="#">Text</a></h2> Notice there are two separate images Here is my current markup which doesnt seem to work $(document).ready(function(){ $("h2.care-home-fees").hover( function () { $(this).addClass("care-home-fees-over"); }, function () { $(this).removeClass("care-home-fees"); } ); }); and the button printed before any change <h2 class="care-home-fees"><a title="Care Home Fees" href="#">Text</a></h2>

    Read the article

  • Hover multiple elements affecting only 1 item

    - by lilsizzo
    hi guys i was wondering if there is a way to hover a few elements with the same class name which is placed side by side and actions would be trigger upon leaving the area of the elements. For example : <div class="hoverme"></div> <div class="hoverme"></div> <div class="hoverme"></div> <div class="hoverme"></div> <div class="hoverme"></div> the javascript of "unhover" below should only be called when they leave the whole area of "hoverme" class. $('.hoverme').live('mouseover mouseout', function(event) { if (event.type == 'mouseover') { if(!$("#stage1 td").hasClass("hover")) { $("#stage1 td").addClass("hover",200) } } else { //$("#stage1 td").removeClass("hover",200) } }); Is there a way for this action??

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >