How to control contextual help section by code?

You could also trigger/simulate the help button being clicked by binding to the ready event.

Pre jQuery 1.7

<script type="text/javascript">
jQuery(document).bind( 'ready', function() {
    jQuery('a#contextual-help-link').trigger('click');
});
</script>

jQuery 1.7+ (bind deprecated as of 1.7)

<script type="text/javascript">
jQuery(document).on( 'ready', function() {
    jQuery('a#contextual-help-link').trigger('click');
});
</script>

The difference here is that you’ll see the help section slide down as the page finishes loading, as if a user had clicked the link.

Can’t hurt to have another option though. 🙂

Leave a Comment