toggle

jquery: Toggle elements based on result from a function

I have a number of table rows that I would like to toggle the visibility of. They should be visible if a data item I have set on them earlier equals a selected value in a form. This is what I have so far: $('#category-selector').change(function(event) { var category_id = $(this).val(); if(!category_id) { $('tr', '#t...

How to change jQuery toggle() status

Using toogle to show/hide the div, I've got a problem that when I hide my div with anothor function, I have to click twice on the button to perform correct action. Is there any way change the toggle switch like I clicked the button? $('#add_task').toggle(function() { if ($("#new_task_status").attr("value")==0) { $("#new_t...

Jquery help : How to implement a Previous/Next & Play/Pause toggle for this script

(function($){ // Creating the sweetPages jQuery plugin: $.fn.sweetPages = function(opts){ // If no options were passed, create an empty opts object if(!opts) opts = {}; var resultsPerPage = opts.perPage || 3; var swDiv = opts.getSwDiv || "swControls"; // The plugin works best for unordered lists, althugh ols would ...

Jquery onclick change value

I have some jquery tabs on my page the code for them is: //tabs options $("#tabs").tabs({ collapsible: true, selected: -1 }); I want to create a button that will toggle the above option 'selected: -1' I need it to change the value of 'selected' to '0' then back to '-1' How would I do this? <a href="#">Toggle View</a> ...

Jquery load into div on toggle

Not sure if this is possible but can you load and unload into a div on a jquery toggle? something a bit like this? $("#IDOFCLICK").live('click',function(){ $(this).toggleClass("active").('#IDOFDIVTOLOAD').load('PAAGETOLOAD').slideToggle("slow"); }); if you can I guess the above is not right, but, how would you also unload on the "rev...

Is there a way to make changes to toggles in my .emacs file apply without re-starting Emacs?

I want to be able to make the changes to my .emacs file without having to reload Emacs. I found three questions which sort of answer what I am asking (you can find them here, here and here), but the problem is that the change I have just made is to a toggle, and as the comments to two of the answers (a1, a2) to those questions explain, ...

Jquery function doesn't work (with smarty).

Hi! I can't find whats the wrong with this script. Please help me! {elseif $text[i].text == "%SubPages"} <!-- js--> {literal} <script type="text/javascript"> $(function(){ $("#button_{/literal}{$text[i].id}{literal}").click(function(event) { event.preventDefault(); $("#settings_{/literal}{$text[i].id}{literal}").toggle(); }); $("#setti...

jQuery toggle elements with class in parent div only

I've been beating my head against my desk for the last two days over this one. I'm making an app that displays info from a db, the title/link, thumbnail, and time saved wrapped in an unordered list, like so: What I'm trying to do is have a minimize button on the element, toggling the thumbnail and time saved on and off: I can accomplis...

Unobtrusive Toggling in a Loop

Hi everyone, I'm using Unobtrusive Toggling in a view that contains many records (Orders). I've got it working on individual divs, but I now want it to work so each Order can be expanded/contracted individually within the loop using its own toggle link (the link is also looped). When my expandable div is called x, the problem is every ...

jQuery Toggle switch images

Hi Guys, I have a situation where I am not understanding jQuery's Toggle. I have two buttons, both of them open the same content and when you click on either button the content should open or close and the attribute changes the button from open to closed. (So both buttons do the same function). Only thing is, when I click on the top ...

Trying to dynamically expand different divs with one function

I'm trying to be able to dynamically expand / collapse multiple divs with the same code.... it's controlled with the click of a span (toggle) and then i'm trying to get the next id(the div that would slide up and down) $('span').toggle( function() { $('#albumholder').slideToggle(600); $(this).html('-');}, functi...

How can I improve this click/toggle function in jquery?

$('.tabs a ').click(function () { var a = $(this).attr('href'); if (a == '#tab-1') { $('.btn-buy').hide(); $('.btn-sell').show(); } else { $('.btn-sell').hide(); $('.btn-buy').show(); } return false; }); ... it works, but the code is ugly, too many lines. Can it be reduced any further...

Jquery toggle with two elements

I am using a toggle on a graphic to slide out a contact form. The problem is, the contact form can cover up the graphic element on low resolutions. I thought a solution would be to include a "close this" inside the form, that would use the same toggle effect. When I add the close this element to the code, instead of working in tandem wit...

I want to be able to use .toggle() but binded to the keydown element - jQuery

I've seen thejQElement.toggle(fn1, fn2, fn3, fn4) would do the trick in case I wanted to click the element. I want it to sequencially fire the events on the tab keydown event. Thanks ...

jquery show/hide/toggle etc.

JQUERY: $("li h2").click(function() { $(this).toggleClass("active").siblings().removeClass("active"); $(this).next("div").slideToggle("fast").siblings("div").slideUp("fast"); }); HTML: <ul> <li> <h2>headingA</h2> <div>contentA</div> <h2>headingB</h2> <div>contentB</div> </li> </ul> NO...

Rails: How to toggle a boolean field from a view?

I have a boolean field called "saved" in my database. I want to toggle this field by clicking on a text link that changes from "Save" to "Unsave" depending on the situation, and updates my "Customer" table with 0 or 1. I imagine Javascript may be a way to go for this but I am not experienced enough (yet!) in Javascript to know how to cod...

jQuery .toggle() not working as expected with second function?!

I'm trying to create a button to show / hide a div below it, all is working fine, I'm just struggling with the last bit! I need to distinguish wether it's a show or hide action so I can pass the variable elsewhere, here's what I have.. $(this).find('.hide-close').click( function() { $(this).siblings('.dragbo...

I need to unset the state of the jQuery .toggle(odd,even)

Hi I have items in a table cell that gets toggled on and off. An external button accepts a click and submits the selected cell values via ajax. The problem is that I want to reset the toggle state for the selected cells. I can easily unset the highlighting, but then need a double click to trigger the correct toggle. Can the .toggle(...

Showing multiple elements onClick

HTML: <ul id="mode"> <li><a href="#tab1">tab1</a> <div class="extra">tada</div> </li> <li><a href="#tab2">tab2</a> <div class="extra">tada</div> </li> </ul> <div id="tab1" class="tab-content" style="display: none">content 1</div> <div id="tab2" class="tab-content" style="display: none">content 2</div...

Mutually exclusive Checkbox in Excel (Toggle)

I have spreadsheet with 50+ checkboxes from the forms toolbar. In a few instances you can only check 1 checkbox from a group i.e you check one checkbox from checkbox 1 to checkbox 5. I'm trying to achieve this without any code if possible. Option button is not preferred since I want an uniformed spreadsheet. How can you group the che...