title: Append method to button created in other method in javascript
body: <p>It is possible add method to event onclik. This code create event onclick in html "onclick='alert("TEST");undefined'". I care to get "onclick='alert("TEST");stdaction('t1')'" where stdaction('t1') is function in class Button</p>
  
  <pre><code>function Button(id,onclick){
          this.id = id;
          this.onclick= onclick;
      }
  
  Button.prototype.create = function(){
      var button = $('&lt;div&gt;');
      button.attr('id',this.id);
      button.html('Default');
      button.attr('onclick',this.onclick+';'+this.stdaction(this.id)); // this is problem
      return button.prop('outerHTML');
  }
  
  Button.prototype.stdaction = function(id){
      $('#'+id).addClass('std-active');
  }
  var oneButton = new Button('t1','alert("TEST")');
  $('#newButton').append(oneButton.create());
  </code></pre>
  
  <p>I changed as suggested Paflow is better, but I wanted to make a function connected running the onclick even had a separate method
  <a href="https://jsfiddle.net/uevckbe0/" rel="nofollow noreferrer">https://jsfiddle.net/uevckbe0/</a></p>