1

I tried below but it does not adjust the column width. Any other idea?

my column name is Progress (internal name is Progress as well) and it's multi-line type field.

Try the below code in a content/script editor webpart. Change the name of the column. I see the max-width of the column is set to 500px. So if you want to make your column width more than 500px, then you have to change the max-width, otherwise that is not needed. I ran this code on SharePoint online and it worked fine.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
<script type='text/javascript'> 
$(document).ready(function(){
    var columnName = 'Progress';
    var element = $("div[name='" + columnName + "']").parent();
    var width = '600px';
    element.css('max-width', width);
    element.css('width', width) 
}); 
</script>

The script below did not work either.

<style>
    /* new class created */
    .ms-longg
    {
        width:500px
    }
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //removed existing class 
        $('input[title="Progress"]').removeClass('ms-long');
        //add New class for that textbox
        $('input[title="Progress"]').addClass('ms-longg');
    });
</script>

2 Answers 2

0

The following worked for me in SP 2010.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript">
</script>
<script type="text/javascript">
$(function(){
    $("div.ms-vh-div:contains('Progress')").css("width", "350px");});
</script>
0

If you don't mind changing the width of all multi-line text fields then modify the PlaceHolderBodyAreaClass content of the page to this:

<asp:Content ContentPlaceHolderId="PlaceHolderBodyAreaClass" runat="server">
<style type="text/css">
.ms-bodyareaframe {
    padding: 8px;
    border: none;
}

.ms-long {
  width:602px;
}

.ms-rtelong {
  width:600px;
}
</style>
</asp:Content>

The .ms-rtelong adjusts the width of the rich-text toolbar if needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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