Search Results

Search found 482 results on 20 pages for 'removeclass'.

Page 11/20 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Attaching a jquery function to some textboxes

    - by diver-d
    I am a newbie to jquery and need a little help. I have created the below function which does what I want it to however when I select a textbox every other textbox are automatically selected. How do I change it and pass a parameter from the textbox so only the selected textboxes css changes on focus and blur? <script language="javascript" type="text/javascript"> $(function () { $('.myTextBox').focus(function () { $('.box.textbox').addClass("active"); }).blur(function () { $('.box.textbox').removeClass("active"); }); }); </script>

    Read the article

  • Dynamic change of class of <TR> with Jquery

    - by Coronier
    Hi all, This is my first post, and first please forgive me for my poor english. I have a problem I really can't fix: I have a <table> of questions, the first question is visible (class:visible), the others are hidden (class:hidden) $(document).ready(function(){ $('.hidden').hide(); When people click on the first question, I want the second question to appear (and the first question to turn to grey, using a 'done' class). $('.visible:not(.done)').click(function(){ $(this).addClass('done'); $('.hidden:first').toggle(500).removeClass('hidden').addClass('visible'); }) The first question is now done (class:done) and the 2nd question should be the only one to react to a click(), and so on... But it doesn't work: the other <tr> appear only when I click on the 1st <tr>. Can someone give me a hand on this problem ? Thank you.

    Read the article

  • 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 parent()

    - by Happy
    jQuery snippet: $(".sliders dt a").click(function(){ $(this).parent().parent().parent().find(".triggers a").removeClass("active"); return false }); HTML: <div class="triggers"><a href="#" class="active">Hide all</a></div> <dl class="sliders"> <dt><a href="#">text</a></dt> <dd>text</dd> </dl> Three .parent() is used, to catch .triggers block. Is there any way to merge them?

    Read the article

  • jQuery + Simple Dialog

    - by Panther24
    Hi, I have a jQuery Model windows which contains a form. On creating of the page, I'm able to see the fields although in my dialog, i have set autoOpen to false. All the forms are in a div. a sample of my dialog looks like this: $("#dialog-form").dialog({ autoOpen: false, height: 460, width: 750, modal: true, buttons: { 'Create Map': function() { document.registerFrm.submit(); }, Cancel: function() { $(this).dialog('close'); } }, close: function() { allFields.val('').removeClass('ui-state-error'); } }); Any way to resolve, I don't want the form fields to be visible on load/creation of the page.

    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

  • [jQuery] Refactoring Tabs

    - by Nimbuz
    $('#mode li:first').addClass('active'); $('#mode li.active').append('<span class="arrow">&nbsp;</span>'); $('#mode li a').click(function () { $('#mode li').removeClass('active') $('.arrow').remove(); $(this).parent().addClass('active').append('<span class="arrow">&nbsp;</span>'); var a = $(this).attr('href'); $('.tab-content').hide(); $(a).show(); return false; }); .. works, but looking ugly. Can it be simplified/reduced further? Many thanks!

    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

  • 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

  • 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

  • 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

  • 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 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

  • 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

  • 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: addClass() not changing background on selector

    - by centr0
    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('href').substr(1); $('#' + selected).stop(true,true).fadeIn(); return false; }); console.log() in firebug returns the correct element being clicked but $(this).addClass('box-selected') does not change the background of the currently clicked element. any ideas? TIA

    Read the article

  • How can I remove all classes that are not named "message" from an element?

    - by Marilou
    I have the following: <div id="abc"> </div> Inside that div there can be one only of the following: <p class="message"> <p class="message error"></p> <p class="message warning"></p> <p class="message success"></p> <p class="message loading"></p> Is there a way that I can find and remove only the class from the <p> element that's NOT "message". I realize I could remove everything and then add what I need with .removeClass() but this won't work for me as after I previously added the message class I did some CSS changes and these will be lost if I remove all and then add again the message class.

    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

  • How to change a label's text after loading a html into a dialog

    - by Salsa
    I am opening a modal dialog by loading a form into it. After loading the form, I want to change it's title and one of it's fields' label. I can change the label's text, but after the function returns, the label's text turns back to it's original one. Is it possible to make this kind of change and if so, how? The HTML: <form action="testing.php" method="POST" id="example-form"> <fieldset> <label for="link" id="link-label"></label> </fieldset> </form> The javascript: $(".bt-example").button().click(function() { $('#example-dialog').load('form.html').dialog('open'); $('.ui-dialog-titlebar').text("THIS WORKS!"); $('#example-form #link-label').text("CHANGES AT FIRST, BUT GOES BLANK LATER"); $('#example-dialog').removeClass('invisible'); });

    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

  • Is my JavaScript/jQuery methodology good? [migrated]

    - by absentx
    I am seeking critique on what has become my normal methodology of writing JavaScript code. I have become heavily reliant on the jQuery library, but I think this has helped me learn the native language better also. Anyway, please critique the following style of JavaScript coding... Buried are a lot of questions of scope; if you could point out the strengths and weaknesses of this style I would appreciate it. var critique ={ start: function(){ globalness = 'GLOBAL-GLOBAL'; //Available to all critique's methods var notglobalness = 'LOCAL-LOCAL'; // Only available to critiques start method //Am I using the "method" teminology properly here?? $('#stuff').on('click','a.closer-target',function(){ $target = $(this); if($target.hasClass('active')){ $target.removeClass('active'); } else{ $target.addClass('active'); critique.madness($target); } }) console.log(notglobalness+': at least I am useful at home'); console.log('note here that: '+notglobalness+' is no longer available after this point, lets continue on:'); critique.madness(notglobalness); }, madness: function($e){ //Do a bunch of awesomeness with $e, //but continue to keep it seperate because you think its best to keep things isolated. //Send to the next function when complete here console.log('Here is globalness, which is still available from the start method of critique!! ' + globalness); console.log('Let us see if the globalness carries on to a new var object!!'); console.log('The locally isolated variable of NOTGLOBALNESS is available here, because it was passed to this method. Let us show it:'+$e); carryOn.start(); } } //end critique var carryOn={ start: function(){ console.log('any chance critique.globalness will work here??? lets see: ' +globalness); console.log('it absolutely does'); } } $(document).ready(critique.start); (I always struggle with which of the Stack Exchange sites is best to post "questions of theory" like this, but I think Programmers is the best, if not, as usual a mod will move it, etc...)

    Read the article

  • JQuery Validation [migrated]

    - by user41354
    Im trying to get my form to validate...so basically its working, but a little bit too well, I have two text boxes, one is a start date, the other an end date in the format of mm/dd/yyyy if the start date is greater than the end date...there is an error if the end date is less than the start date...there is an error if the start date is less than today's date...there is an error The only thing is when I correct the error, the error warning is still there...here is my code: dates.change(function () { var testDate = $(this).val(); var otherDate = dates.not(this).val(); var now = new Date(); now.setHours(0, 0, 0, 0); // Pass Dates if (testDate != '' && new Date(testDate) < now) { addError($(this)); $('.flightDateError').text('* Dates cannot be earlier than today.'); isValid = false; return; } // Required Text if ($(this).hasClass("FromCal") && testDate == '') { addError($(this)); $('.flightDateError').text('* Required'); isValid = false; return; } // Validate Date if (!isValidDate(testDate)) { // $(this).addClass('validation_error_input'); addError($(this)); $('.flightDateError').text('* Invalid Date'); isValid = false; return; } else { // $(this).removeClass('validation_error_input'); removeError($(this)); if (!dates.not(this).hasClass('validation_error_input')) $('.flightDateError').text(' '); } // Validate Date Ranges if ($(this).val() != '' && dates.not(this).val != '') { if ($(this).hasClass("FromCal")) { if (new Date(testDate) > new Date(otherDate)) { addError($(this)); $('.flightDateError').text('* Start date must be earlier than end date.'); isValid = false; return; } } else{ if (new Date(testDate) < new Date(otherDate)) { addError($(this)); $('.flightDateError').text('* End date must be later than start date.'); return; } } } }); The main Issue is this part, I believe // Validate Date Ranges if ($(this).val() != '' && dates.not(this).val != '') { if ($(this).hasClass("FromCal")) { if (new Date(testDate) > new Date(otherDate)) { addError($(this)); $('.flightDateError').text('* Start date must be earlier than end date.'); isValid = false; return; } } else{ if (new Date(testDate) < new Date(otherDate)) { addError($(this)); $('.flightDateError').text('* End date must be later than start date.'); return; } } } testDate is the start date otherDate is the end date Thanks in advanced, J

    Read the article

  • is this correct use of jquery's document.ready?

    - by Haroldo
    The below file contains all the javascript for a page. Performance is the highest priority. Is this the most efficient way? Do all click/hover events need to to be inside the doc.ready? //DOCUMENT.READY EVENTS //--------------------------------------------------------------------------- $(function(){ // mark events as not loaded $('.event').data({ t1_loaded: false, t2_loaded: false, t3_loaded: false, art_req: false }); //mark no events have been clicked $('#wrap_right').data('first_click_made', false); // cal-block event click $('#cal_blocks div.event, #main_search div.event').live('click', function(){ var id = $(this).attr('id').split('e')[1]; event_click(id); }); // jq history $.historyInit(function(hash){ if(hash) { event_click(hash); } }); // search $('#search_input').typeWatch ({ callback: function(){ var q = $('#search_input').attr('value'); search(q); }, wait : 350, highlight : false, captureLength : 2 }); $('#search_input, #main_search div.close').live('click',function(){ $(this).attr("value",""); reset_srch_res(); }); $('#main_search').easydrag(); $('a.dialog').colorbox(); //TAB CLICK -> AJAX LOAD TAB $('#wrap_right .rs_tabs li').live('click', function(){ $this = $(this); var id = $('#wrap_right').data('curr_event'); var tab = parseInt($this.attr('rel')); //hide other tabs $('#rs_'+id+' .tab_body').hide(); //mark current(clicked) tab $('#rs_'+id+' .rs_tabs li').removeClass('curr_tab'); $this.addClass('curr_tab'); //is the tab already loaded and hidden? var loaded = $('#e'+id).data('t'+tab+'_loaded'); //console.log('id: '+id+', tab: '+tab+', loaded: '+loaded); if(loaded === true) { $('#rs_'+id+' .tab'+tab).show(); if (tab == 2) { art_requested(id); } } else { //ajax load in the tab $('#rs_'+id+' .tab'+tab).load('index_files/tab'+tab+'.php?id='+id, function(){ //after load callback if (tab == 1) { $('#rs_' + id + ' .frame').delay(600).fadeIn(600) }; if (tab == 2) { art_requested(id); } }); //mark tab as loaded $('#e'+id).data('t'+tab+'_loaded', true); //fade in current tab $('#rs_'+id+' .tab'+tab).show(); } }) }); // LOAD RS FUNCTIONS //--------------------------------------------------------------------------- function event_click(id){ window.location.hash = id; //mark current event $('#wrap_right').data('curr_event', id); //hide any other events if($('#wrap_right').data('first_click_made') === true) { $('#wrap_right .event_rs').hide(); } //frame loaded before? var loaded = $('#e'+id).data('t1_loaded'); if(loaded === true) { $('#rs_'+id).show(); } else { create_frame(id); } //open/load the first tab $('#rs_'+id+' .t1').click(); $('#wrap_right').data('first_click_made', true); $('#cal_blocks').scrollTo('#e'+id, 1000, {offset: {top:-220, left:0}}); } function create_frame(id){ var art = ents[id].art; var ven = ents[id].ven; var type = ents[id].gig_club; //select colours for tabs if(type == 1){ var label = 'gig';} else if(type == 2){ var label = 'club';} else if(type == 0){ var label = 'other';} //create rs container for this event var frame = '<div id="rs_'+id+'" class="event_rs">'; frame += '<div class="title_strip"></div>'; frame += '<div class="rs_tabs"><ul class="'+label+'"><li class="t1 nav_tab1 curr_tab hand" rel="1"></li>'; if(art == 1){frame += '<li class="t2 nav_tab2 hand" rel="2"></li>';} if(ven == 1){frame += '<li class="t3 nav_tab2 hand" rel="3"></li>';} frame += '</ul></div>'; frame += '<div id="rs_content"><div class="tab_body tab1" ></div>'; if(art == 1){frame += '<div class="tab_body tab2"></div>';} if(ven == 1){frame += '<div class="tab_body tab3"></div>';} frame += '</div>'; frame += '</div>'; $('#wrap_right').append(frame); //mark current event in cal-blocks $('#cal_blocks .event_sel').removeClass('event_sel'); $('#e'+id).addClass('event_sel'); if($('#wrap_right').data('first_click_made') === false) { $('#wrap_right').delay(500).slideDown(); $('#rs_'+id+' .rs_tabs').delay(800).fadeIn(); } }; // FUNCTIONS //--------------------------------------------------------------------------- //check to see if an artist has been requested function art_requested(id){ var art_req = $('#e'+id).data('art_req'); if(art_req !== false) { //alert(art_req); $('#art_'+art_req).click(); } } //scroll artist panes smoothly (scroll bars cause glitches otherwise) function before (){ if(!IE){$('#art_scrollable .bio_etc').css('overflow','-moz-scrollbars-none');} } function after (){ if(!IE){$('#art_scrollable .bio_etc').css('overflow','auto');} } function prep_media_carousel(){ //youtube and soundcloud player $("#rs_content .yt_scrollable a.yt, #rs_content .yt_scrollable a.sc").colorbox({ overlayClose : false, opacity : 0 }); $("#colorbox").easydrag(true); $('#cboxOverlay').remove(); } function make_carousel_scrollable(unique_id){ $('#scroll_'+unique_id).scrollable({ size:1, clickable:false, nextPage:'#r_'+unique_id, prevPage:'#l_'+unique_id }); } function check_l_r_arrows(total, counter, art_id){ //left arrow if(counter > 0) { $('#l_'+art_id).show(); $('#l_'+art_id+'_inactive').hide(); } else { $('#l_'+art_id).hide(); $('#l_'+art_id+'_inactive').show(); } //right arrow if(counter < total-3) { $('#r_'+art_id).show(); $('#r_'+art_id+'_inactive').hide(); } else { $('#r_'+art_id).hide(); $('#r_'+art_id+'_inactive').show(); } } function reset_srch_res(){ $('#main_search').fadeOut(400).children().remove(); } function search(q){ $.ajax({ type: 'GET', url: 'index_files/srch/search.php?q='+q, success: function(e) { $('#main_search').html(e).show(); } }); }

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >