SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

ms-vh2 exists by verifying "view source" but I cant get the following code to do the tricks for me. any idea??

<script src="" type="text/javascript"></script>
<script type="text/javascript">
    $(" th:contains('Name')").css("width", "315px");
    //$("'Name')").css("width", "50px");
    //$("'Title')").css("width", "350px");
    //$("'LongDescription')").css("width", "350px");
share|improve this question
up vote 1 down vote accepted

The selector is working for me. Try this to see if the selector is working for you:

$("'Name')").css("background-color", "red");  

It might be that your selector is working, but the css seems like it isn't. What I mean by this is that I can't reduce the width of the <th> to 1px because the content that it contains won't allow it to be that small.

share|improve this answer
Red background works. However, no matter what i put 1px or 1000 px it does not change. i think ootb css overwrites the width piece. – Mary Rivers Oct 19 '11 at 19:40
I guess Marc is right . You're adjusting the table header cell (TH), but not the table detail cells (TDs) below them. The widest cell usually wins. – Mary Rivers Oct 19 '11 at 20:00
I was able to adjust the width, but was not able to make it that small. Check out this article.… You can use the _spBodyOnLoadFunctionNames.push method to ensure the body of the document has loaded before your JQuery runs. – Panter Oct 19 '11 at 20:10
I thank you for trying this for me and find a solution. But this did not work for me. <script language="javascript"> _spBodyOnLoadFunctionNames.push("FunctionName"); function FunctionName() { // Code } </script> – Mary Rivers Oct 20 '11 at 13:48
Actually, I turned on the developer tools for IE and I get an error on this line _spBodyOnLoadFunctionNames.push('ColumnWidth'); I tried _spBodyOnLoadFunctionNames.push("ColumnWidth"); but same error – Mary Rivers Oct 20 '11 at 14:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.