You can find jqGrids existing on the page in many ways. For example, you can use $('table.ui-jqgrid-btable') instead of $('div.ui-jqgrid-bdiv table') . In addition, you should not forget that it can be more like one jqGrid on the page as a whole. I recommend you write your code so that it works with many jqGrids per page, even if you use only one jqGrid per page.
If you somehow find the table jqGrid element, you can get the DOM element from the first grid found with jqGrids[0] . jqGrid uses some DOM extensions. It adds additional grid and p properties. Each jqGrid method will check to see if the grid is initialized, confirming that the grid property exists. The p property gives you all jqGrid parameters inclusive of p.pager . You can create up to two pagers on the grid: one at the top edge of the grid and the other at the bottom (see this for more information). So the code you need may look like
var jqGrids = $('table.ui-jqgrid-btable'); if (jqGrid.length > 0) { jqGrid.each(function(i) { if (this.grid) { // one more test for the jqGrid // jqGrid[i] is a jqGrid if (this.p.toppager) { // this.id + '_toppager' is the id of the top pager } if (this.p.pager) { // this.p.pager is the id of the bottom pager } } }); }
To check if the table element has some customclass class, you can use jQuery.hasClass .
UPDATED . In a comment, you asked me how to hide or show buttons on the navigation bar dynamically. I have prepared demos that demonstrate this:

If you check the buttons located above the grid, the corresponding button from the navigation panel will be hidden. Uncheck the box by showing the corresponding button.
The code simply calls $('#add_list').hide() or $('#add_list').show() to hide / show the Add button. In the example, the last part id = "add_list" is the identifier of the <table> element used to create the grid. Other standard buttons have identifiers starting with the following prefixes: 'edit_' , 'view_' , 'del_' , 'search_' , 'refresh_' . The more common code that works if the grid identifier has special characters is as follows:
var grid = $("#list"), gid = $.jgrid.jqID(grid[0].id); $('#cbAdd').change(function () { var $td = $('#add_' + gid); if ($(this).is(':checked')) { $td.hide(); } else { $td.show(); } });
To find custom navigator buttons added by navButtonAdd I use the title attribute:
$('#cbChooseColumns').change(function () { var $td = $(grid[0].p.pager + '_left ' + 'td[title="choose columns"]'); if ($(this).is(':checked')) { $td.hide(); } else { $td.show(); } });