code: function updateButton(opts) {
      var $result;
      var $toolbar = $('.book-header');
      var $title = $toolbar.find('h1');
  
      // Build class name
      var positionClass = 'pull-'+opts.position;
  
      // Create button
      var $btn = $('<a>', {
          'class': 'btn',
          'text': opts.text? ' ' + opts.text : '',
          'aria-label': opts.label,
          'href': '#'
      });
  
      // Bind click
      $btn.click(opts.onClick);
  
      // Prepend icon
      if (opts.icon) {
          $('<i>', {
              'class': opts.icon
          }).prependTo($btn);
      }
  
      // Prepare dropdown
      if (opts.dropdown) {
          var $container = $('<div>', {
              'class': 'dropdown '+positionClass+' '+opts.className
          });
  
          // Add button to container
          $btn.addClass('toggle-dropdown');
          $container.append($btn);
  
          // Create inner menu
          var $menu = createDropdownMenu(opts.dropdown);
  
          // Menu position
          $menu.addClass('dropdown-'+(opts.position == 'right'? 'left' : 'right'));
  
          $container.append($menu);
          $result = $container;
      } else {
          $btn.addClass(positionClass);
          $btn.addClass(opts.className);
          $result = $btn;
      }
  
      $result.addClass('js-toolbar-action');
  
      if (_.isNumber(opts.index) && opts.index >= 0) {
          insertAt($toolbar, '.btn, .dropdown, h1', opts.index, $result);
      } else {
          $result.insertBefore($title);
      }
  }
docs: Update a button