(Bootstrap) - Changing dropdown button text to reflect item clicked removes caret

With your current code, appending the caret icon code will help you retain it after changing the drop down value.

function dropdown(val) {
  var y = document.getElementsByClassName('btn btn-default dropdown-toggle');
  var aNode = y[0].innerHTML = val + ' <span class="caret"></span>'; // Append 
}
<head>
  <!-- Latest compiled and minified CSS -->
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

  <!-- jQuery library -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

  <!-- Latest compiled JavaScript -->
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>

<body>
  <div class="dropdown">
    <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" value="Fast">Fast
      <span class="caret"></span>
    </button>
    <ul class="dropdown-menu" value="Fast">
      <li onclick="dropdown(this.innerHTML);">Fast</li>
      <li onclick="dropdown(this.innerHTML);">Accurate</li>
    </ul>


.innerHTML will get you the entire content, including the inner span that you are using for the caret.

What you need is the textContent of the firstchild of your dropdown, which is actually a textNode.

Example Snippet:

var dropdown = document.getElementsByClassName('dropdown-toggle')[0],
    options = document.getElementsByClassName('dropdown-menu')[0]
;

options.addEventListener("click", function(e) {
    if (e.target.tagName === 'A') {
      dropdown.firstChild.textContent = e.target.textContent + ' ';
    }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<div class="dropdown">
  <button id="dropdownBtn" class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">Fast <span class="caret"></span>
  </button>
  <ul class="dropdown-menu">
    <li><a href="#">Fast</a></li>
    <li><a href="#">Accurate</a></li>
  </ul>
</div>