0

Using a script editor on my new form I added this script.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"   type="text/javascript"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function() {
$("nobr").css("white-space","normal"); // Lets labels wrap
$("input[title^=lbl]").parent().parent().prev().each(function(index){
// Finds the TR that contains the label (change lbl to your prepend convention)
var lblText = $(this).next().find("span > input").val();
// Gets the label text (the default value)
$(this).parent().before("<tr class='ms-SPButton ms-WPAddButton'>" +
"<td nowrap=true valign=top width=100% class='ms-formlabel' colspan=2>" +
"<h3 class='ms-standardheader ms-WPTitle'>" + lblText +
"</h3></td></tr>"); // Adds a TR formatted as label
$(this).parent().hide(); // Hides the default TR
});
});
</script>

Now when you hit "New Item" it creates this label enter image description here

I want to make the text next to the arrow bold. How do I go about doing this? Any help would be appreciated. Thanks!

1

using Jquery you can apply the CSS.

$yourElement.css("font-weight","Bold"); // $(this).css("font-weight","Bold");
  • I'm not 100% sure how to do this i found the code snippet above on another site. – jvonesh Sep 17 '14 at 18:36
0

Maybe the soloution to this questing could help:

How to brand my masterpage using provider hosted apps?

0

Try this and see if it works for you:

$(document).ready(function(){

var control;  

control = findacontrol("your column name");
control.parentNode.parentNode.style.fontWeight="bold";

    });

function findacontrol(FieldName) {

var arr = document.getElementsByTagName("!");
// get all comments
for (var i=0;i < arr.length; i++ )
{
  // now match the field name
  if (arr[i].innerHTML.indexOf(FieldName) > 0)
  {         return arr[i];      }
 }
}

This works for column control values in the form. Not sure if it will work for you but I know it makes my radio button values in my forms bold. See if you can play with it and make it work for you.

EDIT:

Just like @Anuja suggested, you can use JQuery to grab the element in a document ready. For SharePoint form fields, you can use the title to grab the element instead of the nasty ID and class it renders.

Try this:

$(document).ready(function(){

    $('input[title*="columnTitle"]').css('font-weight', 'bold');

});
  • so i should copy the whole thing and place it after the first line? – jvonesh Sep 17 '14 at 18:21
  • Yes. Just replace what you have with this code and see if it works for you. – lazoDev Sep 17 '14 at 18:22
  • unfortunately no luck :/ – jvonesh Sep 17 '14 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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