title: Razor Helper in App_Code and Javascript
body: <p>I want to create a component that can be consumed by multiple views and I want to associate Javascript to manipulate elements in my component.
  So I created a HtmlHelper in App_Code RAZOR like this:</p>
  
  <pre><code>@helper HswToolbar()
  {
  
      &lt;header&gt;
          &lt;button class="btn btn-block btn-primary btn-flat pull-left hswbutton"&gt;Quitter&lt;/button&gt;
  
          &lt;button class="btn btn-block btn-primary btn-flat pull-right hswbutton"&gt;Détail&lt;/button&gt;
      &lt;/header&gt;
  
  
  }
  </code></pre>
  
  <p>In Index.cshtml, I have a file that should allow me to manage interactions with the user of trigger actions. But it is never realized.
  For example, with this code in the _Layout:</p>
  
  <pre><code>@Scripts.Render("~/Scripts/hsw/HtmlHelper.js")
  </code></pre>
  
  <p>and my JS:</p>
  
  <pre><code>$(document).ready(function () {
  
      $(".hswbutton").click(function (e) {
          alert("htmlhelper click OK");
      });
  });
  </code></pre>
  
  <p>Can you help me ?
  Or are there other solutions?</p>