You could make your own plugins.
jQuery.fn.visible = function() { return this.css('visibility', 'visible'); }; jQuery.fn.invisible = function() { return this.css('visibility', 'hidden'); }; jQuery.fn.visibilityToggle = function() { return this.css('visibility', function(i, visibility) { return (visibility == 'visible') ? 'hidden' : 'visible'; }); };
If you want to overload the original jQuery toggle()
, which I don’t recommend…
!(function($) { var toggle = $.fn.toggle; $.fn.toggle = function() { var args = $.makeArray(arguments), lastArg = args.pop(); if (lastArg == 'visibility') { return this.visibilityToggle(); } return toggle.apply(this, arguments); }; })(jQuery);
Related Posts:
- How to change CSS using jQuery?
- Remove class using jQuery
- How can I scroll to an element using jQuery?
- Bootstrap Dropdown menu is not working
- Change Background color (css property) using Jquery
- Set timeout for ajax (jQuery)
- How to generate a simple popup using jQuery
- Use images like checkboxes
- Adding images to a Bootstrap Carousel with AJAX
- Setting background-image using jQuery CSS property
- Uncaught TypeError: Cannot read property ‘top’ of undefined
- TypeError: $(…).modal is not a function with bootstrap Modal
- Why is the jquery script not working?
- TypeError: $(…).DataTable is not a function
- Change text on hover, then return to the previous text
- Refresh/reload the content in Div using jquery/ajax
- How to get height of div in px dimension
- How do I check if an element is hidden in jQuery?
- How to display raw JSON data on a HTML page
- “Uncaught TypeError: a.indexOf is not a function” error when opening new foundation project
- Why is jquery show() not working in example
- jQuery scrollTop() method not working
- Fully responsive HTML5 video
- How to change cursor from pointer to finger using jQuery?
- How can I remove a style added with .css() function?
- How to use aria-expanded=”true” to change a css property
- How to set “style=display:none;” using jQuery’s attr method?
- Failed to load resource: the server responded with a status of 404 (Not Found)
- Failed to load resource: the server responded with a status of 404 (Not Found)
- How to properly use jsPDF library
- How do I redirect to another webpage?
- Angular: conditional class with *ngClass
- How do I redirect to another webpage?
- Cross-Origin Read Blocking (CORB)
- jQuery append() vs appendChild()
- How to replace innerHTML of a div using jQuery?
- Uncaught ReferenceError: $ is not defined?
- Uncaught ReferenceError: jQuery is not defined [duplicate]
- How do I check whether a checkbox is checked in jQuery?
- syntax error: unexpected token <
- Error OPTIONS net::ERR_CONNECTION_REFUSED
- ReferenceError: $ is not defined
- Uncaught ReferenceError: jQuery is not defined [duplicate]
- What does [object Object] mean?
- How do I check whether a checkbox is checked in jQuery?
- jQuery document.createElement equivalent?
- How to make history.back() without getting a warning on the browser to reload the page?
- JQuery – $ is not defined
- Cannot read property ‘push’ of undefined when combining arrays
- Toggle show/hide on click with jQuery
- convert Hsl to rgb and hex
- Pure JavaScript equivalent of jQuery’s $.ready() – how to call a function when the page/DOM is ready for it [duplicate]
- JQuery – $ is not defined
- Cannot read property ‘push’ of undefined when combining arrays
- jQuery .on(‘change’, function() {} not triggering for dynamically created inputs
- How to create a jQuery function (a new jQuery method or plugin)?
- jQuery: Wait/Delay 1 second without executing code
- Failed to load resource: the server responded with a status of 500 (Internal Server Error) in Bind function
- Scroll to an element with jQuery
- Download File Using JavaScript/jQuery
- How to solve ‘Redirect has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header’?
- How to deal with net::ERR_SSL_PROTOCOL_ERROR?
- jQuery.click() vs onClick
- jQuery setTimeout() Function [duplicate]
- jQuery Get Selected Option From Dropdown
- Disabling and enabling a html input button
- Scroll to an element with jQuery
- Download File Using JavaScript/jQuery
- Check if checkbox is checked with jQuery
- How can I refresh a page with jQuery?
- How can I refresh a page with jQuery?
- Getting Error “Form submission canceled because the form is not connected”
- How to add jQuery code into HTML Page
- How can I get the data-id attribute?
- document.getElementById vs jQuery $()
- Check if checkbox is checked with jQuery
- How to import jquery using ES6 syntax?
- How to filter an array/object by checking multiple values
- What does jQuery.fn mean?
- Getting Error “Form submission canceled because the form is not connected”
- “Uncaught TypeError: Cannot read property ‘style’ of null at.. “
- Is there a link to the “latest” jQuery library on Google APIs?
- What is the meaning of == $0 that is shown in inspect element of google chrome for the selected element [duplicate]
- Setting “checked” for a checkbox with jQuery
- Nested JSON objects – do I have to use arrays for everything?
- How to find the sum of an array of numbers
- Uncaught TypeError: Cannot read property ‘length’ of undefined
- Jquery : Refresh/Reload the page on clicking a button
- Uncaught SyntaxError: Invalid or unexpected token
- Check if element exists in jQuery
- Checking a Url in Jquery/Javascript
- Infinite Scrolling in Asp.Net MVC with jQuery / AJAX Issues
- ajax jquery simple get request
- What are the difference between $(document).bind(‘ready’, function) and $(document).ready(function() {})
- jquery SlideToggle effect in upward direction?
- jQuery get textarea text
- How can jQuery deferred be used?
- Uncaught TypeError : cannot read property ‘replace’ of undefined In Grid
- How can I determine if a variable is ‘undefined’ or ‘null’?
- Failed to load resource: net::ERR_FILE_NOT_FOUND loading json.js