JQuery Toggle Button Trigger

html, javascript, jquery, jquery-ui, toggle

Solution

Like this:

$('.access a').trigger('click');

Since toggle is just functions that are swapped and executed on a click, that's what you want to trigger. Also available is the shortcut:

$('.access a').click(); //Same as first method

Problem

i have this code: ``` $('.access a').toggle(function() { $('link').attr('href', 'styles/accessstyles.css'); $('body').css('font-size', '16px'); }, function() { $('link').attr('href', 'styles/styles.css'); $('body').css('font-size', text_sizes[text_current_size] + 'px'); }); ``` It works fine. But how would i programmatically trigger the toggle instead of clicking on it?

Original source