<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jose V</title>
    <description>The latest articles on Forem by Jose V (@jocvegar).</description>
    <link>https://forem.com/jocvegar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F269623%2F257f3667-22fe-4ba5-9df5-1a9e51d3099b.jpeg</url>
      <title>Forem: Jose V</title>
      <link>https://forem.com/jocvegar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jocvegar"/>
    <language>en</language>
    <item>
      <title>Rails 7 JS on page load</title>
      <dc:creator>Jose V</dc:creator>
      <pubDate>Sat, 26 Feb 2022 02:59:43 +0000</pubDate>
      <link>https://forem.com/jocvegar/rails-7-js-on-page-load-2142</link>
      <guid>https://forem.com/jocvegar/rails-7-js-on-page-load-2142</guid>
      <description>&lt;p&gt;After diving in many rabbit holes trying to figure out why my JS was not loading after using rails link helper &lt;code&gt;link_to&lt;/code&gt;... I think I have the answer. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://guides.rubyonrails.org/working_with_javascript_in_rails.html#page-change-events"&gt;Rails guide&lt;/a&gt; tells us one thing however, this seems to be working for me&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;document.addEventListener("turbo:load", function () {
  yourFunction();
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope this helps you!&lt;/p&gt;

&lt;p&gt;demo: &lt;a href="https://rails-7-esbuild.herokuapp.com/"&gt;https://rails-7-esbuild.herokuapp.com/&lt;/a&gt;&lt;br&gt;
repo: &lt;a href="https://github.com/jocvegar/rails_7_esbuild"&gt;https://github.com/jocvegar/rails_7_esbuild&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rails</category>
      <category>javascript</category>
      <category>ruby</category>
    </item>
  </channel>
</rss>
