2

I have a MultiField Choice list item. By default it displays:

Choice 1, Choice 2, Choice 3, Choice 4,

I would like it to display like the following.

Choice 1,
Choice 2,
Choice 3,
Choice 4

I have tried using various versions of

<script type="text/javascript">
  window.onload = clear(); 
  function clear() { 
    document.body.innerHTML = document.body.replace(',', 'br'); 
  } 
</script>

However when I use this code the whole page is blank.

I also used this script with limited success

<button onclick="ChangeText()">Button</button>

<script>
function ChangeText() {
  var str = document.getElementById("list").innerHTML;
  var res = str.replace(",", "[br]");
  document.getElementById("list").innerHTML = res;
}
</script>

This would only change one line and on clicking the button.

I have a feeling I am making this more complicated then it needs to be.

Your Answer

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

Browse other questions tagged or ask your own question.