Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 857471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:24:10+00:00 2026-05-15T08:24:10+00:00

I would like to center the titlebar text on a jqGrid without messing up

  • 0

I would like to center the titlebar text on a jqGrid without messing up the open/close image. But I’ve only been able to get both the text and open/close button-image centered. I would be grateful for some tips on how to get the text centered while keeping the anchor-image positioned.

Here’s the markup that Chrome’s Inspector shows:

<div class="ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix">
   <a role="link" href="javascript:void(0)"
      class="ui-jqgrid-titlebar-close HeaderButton" style="right: 0px;">       
       <span class="ui-icon ui-icon-circle-triangle-n"></span>
   </a>
   <span class="ui-jqgrid-title">Titles</span>
 </div>

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:24:11+00:00Added an answer on May 15, 2026 at 8:24 am

    Try with following

    jQuery(".ui-jqgrid-title").replaceWith('<div style="text-align: center;"><span>' +
            jQuery(".ui-jqgrid-title").text() + '</span></div>');
    

    or with

    jQuery(".ui-jqgrid-title").replaceWith(
        '<div style="text-align: center; padding: .3em .2em .2em .3em;"><span>' +
        jQuery(".ui-jqgrid-title").text() + '</span></div>');
    

    UPDATED: I should a little fix my solution to 1) allow setCaption method continue working; 2) to work correct if one have more as one jqGrid on a page:

    var captionDiv = jQuery("#list")[0].grid.cDiv;
    var titleSpan = jQuery(".ui-jqgrid-title",captionDiv);
    titleSpan.css ("float", "none");
    titleSpan.parent().css ("text-align", "center");
    

    In the code “list” is the id of <table> element of the grid. DOM element of jqGrid (jQuery("#list")[0]) is expanded with grid property which has as a properties DOM elements of three important jqGrid components (cDiv – caption, hDiv – table headers and bDiv – table body). We use .grid.cDiv to get DOM element of the caption (grid header) in the most quick way. Then we give a span element of the caption and overwrite "float: left" style of the "ui-jqgrid-title" class which probably made you the most problem. At the end we set additional style of the parent div element to "text-align: center" to finish all work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to vertically center my main content div. I am open to
I would like to center the icon in one of my columns. The way
I would like to center justify a given input string to a given size
I would like to center a string against another string by making sure the
i would like to center a popup div how can i do that browser
I'm using the Google Maps API (v2) and would like to center the map
I have an aspx Login control and I would like to center it on
Essentially I would like to apply a bottom-border , but rather than being in
Simply put, I would like to make java do what I want but I
I would like to get a sum from a column, with and without a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.