0

I have an issue with both JavaScript and CSS in changing 'Specify your own value:' I have previously had this script and CSS work. The form has been customized with some heading styles within the xsl via SP Designer as well as some attachment fields added into the body of the form. Does anyone have an idea why the script/CSS is being ignored?

<style type="text/css"> label [for="ctl00_ctl40_g_bae77b70_6712_4cbb_9705_db9e1a98ecce_ff51_xxxxx_xxxxx"]:before{content:'Specify your own value:'} label[for="ctl00_ctl40_g_bae77b70_6712_4cbb_9705_db9e1a98ecce_ff51_xxxxx_xxxxx"].othertext:before{content:'If Other, please specify'} </style>

 <script type="text/javascript">
 jQuery(document).ready(function($){
  $("input[value='FillInButton']").each(function()
  {
  var inputID = $(this).attr("id");
  $("label[for='" + inputID + "']").html("If not listed, specify in the box below");
  }
  );
 })
 </script>
3

I have found a solution. I needed to add _spBodyOnLoadFunctionNames.push("changeSpecifyOwnValue"); I changed the script to the one below:

<script type="text/javascript">
_spBodyOnLoadFunctionNames.push("changeSpecifyOwnValue");
 function changeSpecifyOwnValue() {
  var node_list = document.getElementsByTagName('input');
    
  for (var i = 0; i < node_list.length; i++) { 
      var node = node_list[i];
    
      if (((node.getAttribute('type') == 'radio') && (node.getAttribute('value') != 'DropDownButton')) || (node.getAttribute('type') == 'checkbox')) { 
          if (node.nextSibling.innerHTML=="Specify your own value:") {
           node.nextSibling.innerHTML = "If other, please specify below:";
          }
      }
  }    
 }
</script>

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.