Q:

Javascript replace content in  tag

Here is my HTML code, and there are some <li> tags in it. I plan to use Speed 1, Speed 2, Speed 3, etc. to replace Content. How can I do it on Javascript ?
<div class="btn-group">
  <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">
    Content <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" role="menu">
    <li><a href="#" onclick="javascript:xxxx">Speed 1</a></li>
    <li><a href="#">Speed 2</a></li>
    <li><a href="#">Speed 3</a></li>
    <li><a href="#">Speed 4</a></li>
    <li><a href="#">Speed 5</a></li>
  </ul>
</div>

Could someone give me advice?

A:

Try this,
$('li a').on('click',function(e){
    e.preventDefault();
    $('button').text($(this).text());    
});

Live Demo

