Note that there are some explanatory texts on larger screens.

plurals
  1. POReferenceError: $ is not defined function error
    primarykey
    data
    text
    <p>I'm getting trouble with my jquery script .Who's suppose to count the number of character on the old twitter way . i'm getting <code>ReferenceError: $ is not defined</code> pointing </p> <pre><code>$(function() { </code></pre> <p>here is the script by the way i'm on a rails app .</p> <p><strong>index.hml.erb</strong></p> <pre><code>&lt;% title "Welcome #{current_user.username}" %&gt; &lt;script type="text/javascript"&gt; $(function() { $('#flit_message').keyup(function(){ var content_lenght = $(this).val().length; var remaining = 140 - content_length $('#char_count').html(remaining); }) }) &lt;/script&gt; &lt;%= form_for Flit.new, :html =&gt; {:id =&gt; 'new_flit_form'} do |f| %&gt; &lt;h3 style="float: left;"&gt;What are you doing?&lt;/h3&gt; &lt;h3 id="char_count" style="float: right;font-size: 23px; font-weight: bold; color: #aaa;"&gt;140&lt;/h3&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;!-- &lt;div id="new_flit_form"&gt; --&gt; &lt;%=h f.text_area :message %&gt; &lt;div id="latest_message"&gt; &lt;strong&gt;Latest: &lt;/strong&gt;&lt;%=h @last_flits.message %&gt; &lt;%= distance_of_time_in_words_to_now(@last_flits.created_at)%&gt; ago &lt;/div&gt; &lt;div id="submit_button_container"&gt; &lt;%=h f.submit "update", :class =&gt; "button" %&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;!-- &lt;/div&gt; --&gt; &lt;% end %&gt; &lt;ul id= "flits_list"&gt; &lt;% @flits.each do |flit| %&gt; &lt;li&lt;% if @flits.first == flit %&gt; class="first"&lt;% end %&gt;&gt; &lt;%= image_tag flit.user.gravatar_url %&gt; &lt;div class="flit_message_container"&gt; &lt;%=h link_to flit.user.username %&gt; &lt;%=h flit.message %&gt; &lt;div class="time_ago"&gt; &lt;%= distance_of_time_in_words_to_now(flit.created_at)%&gt; ago &lt;/div&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/li&gt; &lt;% end %&gt; &lt;/ul&gt; </code></pre> <p><strong>here is the application.js file</strong></p> <pre><code>// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // the compiled file. // // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD // GO AFTER THE REQUIRES BELOW. // //= require jquery //= require jquery_ujs //= require jquery-ui //= require_tree . </code></pre> <p><strong>html page source code</strong></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Welcome breanne&lt;/title&gt; &lt;link href="/assets/application.css?body=1" media="screen" rel="stylesheet" type="text/css" /&gt; &lt;link href="/assets/flits.css?body=1" media="screen" rel="stylesheet" type="text/css" /&gt; &lt;link href="/assets/home.css?body=1" media="screen" rel="stylesheet" type="text/css" /&gt; &lt;link href="/assets/welcome.css?body=1" media="screen" rel="stylesheet" type="text/css" /&gt; &lt;script src="/assets/defaults.js" type="text/javascript"&gt;&lt;/script&gt; &lt;meta content="authenticity_token" name="csrf-param" /&gt; &lt;meta content="JnHvVRrW5Ts6TQf+D35OByvXxEY+Gl6P5NU5dVs8r3o=" name="csrf-token" /&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;h1&gt;Welcome breanne&lt;/h1&gt; &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" &gt; $(function() { $('#flit_message').keyup(function(){ var content_lenght = $(this).val().length; var remaining = 140 - content_length; $('#char_count').html(remaining); }) }) &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload