Adsense
Popular Posts
- Code update from PHP 7.4 to PHP 8.1 - PhpSpreadsheet
- MySQL workbench -"Could not decrypt password cache"
- Code update from PHP 7.4 to PHP 8.1 - Worksheet/Iterator.php
- Rendering HTML tags inside textarea
- axios handle blob type data
- Unix Utils and wget in Windows
- increase mysql query speed
- Setup vi syntax for PHP
- EXCEL return to the next line in the same cell
- Get WAMP running on EC2
Saturday, May 23, 2015
Trigger a click in jQuery
To trigger a click in jQuery, for example id stakeholderAccesses:
$('#stakeholderAccesses').click();
I found following trigger function not working well:
$('#stakeholderAccesses').trigger('click');
Complete example:
$(document).ready(function() {
//Display and Load the body part when the header is clicked.
$('#stakeholderAccesses').click(function() {
if( $(this).parent().children('div').css("display") == "none" ) {
$(this).html( '-' + $(this).html().substring(1) );
$(this).parent().children('div').load('../_ajaxParts/CVS/CVS_Access.php', {sid: $.url.param('sid')}).show('fast');
}
else {
$(this).html( '+' + $(this).html().substring(1) );
$(this).parent().children('div').hide('fast');
}
}).hover(function() {$(this).css('cursor','pointer');},function() {$(this).css('cursor','auto');});
$('#stakeholderAccesses').click();
});
Labels:
jQuery
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment