Why my sortable function does not work in rails?2019 Community Moderator ElectionIs there an “exists” function for jQuery?How do JavaScript closures work?var functionName = function() vs function functionName() How does JavaScript .prototype work?What does “use strict” do in JavaScript, and what is the reasoning behind it?What is JSONP, and why was it created?Why does Google prepend while(1); to their JSON responses?How does the “this” keyword work?Why does ++[[]][+[]]+[+[]] return the string “10”?How does data binding work in AngularJS?
Latest web browser compatible with Windows 98
Placing subfig vertically
Try Catch Block Affecting a Variable in an Enclosing Scope
Set and print content of environment variable in cmd.exe subshell?
Norms on fields
A three room house but a three headED dog
In the late 1940’s to early 1950’s what technology was available that could melt a LOT of ice?
Examples of a statistic that is not independent of sample's distribution?
Is having access to past exams cheating and, if yes, could it be proven just by a good grade?
Can you reject a postdoc offer after the PI has paid a large sum for flights/accommodation for your visit?
Aliens englobed the Solar System: will we notice?
Look through the portal of every day
Force user to remove USB token
Virginia employer terminated employee and wants signing bonus returned
Is it true that real estate prices mainly go up?
Why would one plane in this picture not have gear down yet?
Do I really need to have a scientific explanation for my premise?
How to create a hard link to an inode (ext4)?
How can The Temple of Elementary Evil reliably protect itself against kinetic bombardment?
Can someone explain what is being said here in color publishing in the American Mathematical Monthly?
Why is this plane circling around the Lucknow airport every day?
Low budget alien movie about the Earth being cooked
Solving "Resistance between two nodes on a grid" problem in Mathematica
How did the power source of Mar-Vell's aircraft end up with her?
Why my sortable function does not work in rails?
2019 Community Moderator ElectionIs there an “exists” function for jQuery?How do JavaScript closures work?var functionName = function() vs function functionName() How does JavaScript .prototype work?What does “use strict” do in JavaScript, and what is the reasoning behind it?What is JSONP, and why was it created?Why does Google prepend while(1); to their JSON responses?How does the “this” keyword work?Why does ++[[]][+[]]+[+[]] return the string “10”?How does data binding work in AngularJS?
I want to drag and sort the div of id="sortable" class="sort". I use the function of sortable, but it does not work. Anybody can give advice?
$(document).on('change', '.my_class', function() );
$( function()
$('.sort').sortable();
);<div id="sortable" class="sort">
<%= f.fields_for :questions do |question_form| %>
<div class="question">
<%= question_form.text_field :question_text %>
<%= question_form.select(:question_type, [ 'TEXT','SINGLE OPTION', 'OPTIONS', 'UPLOAD' ],:prompt => 'Select One', :class => "my_class") %>
<%= question_form.link_to_remove "Remove this Question" %>
<%= question_form.fields_for :options do |option_form| %>
<%= option_form.text_field :option_text %>
<%= option_form.link_to_remove "Remove this option" %>
<% end %>
<div class="option" hidden>
<%= question_form.link_to_add "Add a option", :options %>
</div>
</div>
<% end %>
</div>javascript ruby-on-rails
|
show 1 more comment
I want to drag and sort the div of id="sortable" class="sort". I use the function of sortable, but it does not work. Anybody can give advice?
$(document).on('change', '.my_class', function() );
$( function()
$('.sort').sortable();
);<div id="sortable" class="sort">
<%= f.fields_for :questions do |question_form| %>
<div class="question">
<%= question_form.text_field :question_text %>
<%= question_form.select(:question_type, [ 'TEXT','SINGLE OPTION', 'OPTIONS', 'UPLOAD' ],:prompt => 'Select One', :class => "my_class") %>
<%= question_form.link_to_remove "Remove this Question" %>
<%= question_form.fields_for :options do |option_form| %>
<%= option_form.text_field :option_text %>
<%= option_form.link_to_remove "Remove this option" %>
<% end %>
<div class="option" hidden>
<%= question_form.link_to_add "Add a option", :options %>
</div>
</div>
<% end %>
</div>javascript ruby-on-rails
are you getting any error in web console?
– Vishal
Mar 6 at 4:58
No error in console
– wentao hong
Mar 6 at 5:38
Maybe lack of some libraries. As i know the$('.sort').sortable()was implemented by jquery.
– EarlyZhao
Mar 6 at 6:32
@wentaohong Do you use turbolinks?
– Vasilisa
Mar 6 at 15:44
Thanks Vasilisa, turbolinks is the solution.
– wentao hong
Mar 7 at 0:06
|
show 1 more comment
I want to drag and sort the div of id="sortable" class="sort". I use the function of sortable, but it does not work. Anybody can give advice?
$(document).on('change', '.my_class', function() );
$( function()
$('.sort').sortable();
);<div id="sortable" class="sort">
<%= f.fields_for :questions do |question_form| %>
<div class="question">
<%= question_form.text_field :question_text %>
<%= question_form.select(:question_type, [ 'TEXT','SINGLE OPTION', 'OPTIONS', 'UPLOAD' ],:prompt => 'Select One', :class => "my_class") %>
<%= question_form.link_to_remove "Remove this Question" %>
<%= question_form.fields_for :options do |option_form| %>
<%= option_form.text_field :option_text %>
<%= option_form.link_to_remove "Remove this option" %>
<% end %>
<div class="option" hidden>
<%= question_form.link_to_add "Add a option", :options %>
</div>
</div>
<% end %>
</div>javascript ruby-on-rails
I want to drag and sort the div of id="sortable" class="sort". I use the function of sortable, but it does not work. Anybody can give advice?
$(document).on('change', '.my_class', function() );
$( function()
$('.sort').sortable();
);<div id="sortable" class="sort">
<%= f.fields_for :questions do |question_form| %>
<div class="question">
<%= question_form.text_field :question_text %>
<%= question_form.select(:question_type, [ 'TEXT','SINGLE OPTION', 'OPTIONS', 'UPLOAD' ],:prompt => 'Select One', :class => "my_class") %>
<%= question_form.link_to_remove "Remove this Question" %>
<%= question_form.fields_for :options do |option_form| %>
<%= option_form.text_field :option_text %>
<%= option_form.link_to_remove "Remove this option" %>
<% end %>
<div class="option" hidden>
<%= question_form.link_to_add "Add a option", :options %>
</div>
</div>
<% end %>
</div>$(document).on('change', '.my_class', function() );
$( function()
$('.sort').sortable();
);<div id="sortable" class="sort">
<%= f.fields_for :questions do |question_form| %>
<div class="question">
<%= question_form.text_field :question_text %>
<%= question_form.select(:question_type, [ 'TEXT','SINGLE OPTION', 'OPTIONS', 'UPLOAD' ],:prompt => 'Select One', :class => "my_class") %>
<%= question_form.link_to_remove "Remove this Question" %>
<%= question_form.fields_for :options do |option_form| %>
<%= option_form.text_field :option_text %>
<%= option_form.link_to_remove "Remove this option" %>
<% end %>
<div class="option" hidden>
<%= question_form.link_to_add "Add a option", :options %>
</div>
</div>
<% end %>
</div>$(document).on('change', '.my_class', function() );
$( function()
$('.sort').sortable();
);<div id="sortable" class="sort">
<%= f.fields_for :questions do |question_form| %>
<div class="question">
<%= question_form.text_field :question_text %>
<%= question_form.select(:question_type, [ 'TEXT','SINGLE OPTION', 'OPTIONS', 'UPLOAD' ],:prompt => 'Select One', :class => "my_class") %>
<%= question_form.link_to_remove "Remove this Question" %>
<%= question_form.fields_for :options do |option_form| %>
<%= option_form.text_field :option_text %>
<%= option_form.link_to_remove "Remove this option" %>
<% end %>
<div class="option" hidden>
<%= question_form.link_to_add "Add a option", :options %>
</div>
</div>
<% end %>
</div>javascript ruby-on-rails
javascript ruby-on-rails
edited Mar 6 at 15:47
Vasilisa
2,97521120
2,97521120
asked Mar 6 at 4:29
wentao hongwentao hong
163
163
are you getting any error in web console?
– Vishal
Mar 6 at 4:58
No error in console
– wentao hong
Mar 6 at 5:38
Maybe lack of some libraries. As i know the$('.sort').sortable()was implemented by jquery.
– EarlyZhao
Mar 6 at 6:32
@wentaohong Do you use turbolinks?
– Vasilisa
Mar 6 at 15:44
Thanks Vasilisa, turbolinks is the solution.
– wentao hong
Mar 7 at 0:06
|
show 1 more comment
are you getting any error in web console?
– Vishal
Mar 6 at 4:58
No error in console
– wentao hong
Mar 6 at 5:38
Maybe lack of some libraries. As i know the$('.sort').sortable()was implemented by jquery.
– EarlyZhao
Mar 6 at 6:32
@wentaohong Do you use turbolinks?
– Vasilisa
Mar 6 at 15:44
Thanks Vasilisa, turbolinks is the solution.
– wentao hong
Mar 7 at 0:06
are you getting any error in web console?
– Vishal
Mar 6 at 4:58
are you getting any error in web console?
– Vishal
Mar 6 at 4:58
No error in console
– wentao hong
Mar 6 at 5:38
No error in console
– wentao hong
Mar 6 at 5:38
Maybe lack of some libraries. As i know the
$('.sort').sortable() was implemented by jquery.– EarlyZhao
Mar 6 at 6:32
Maybe lack of some libraries. As i know the
$('.sort').sortable() was implemented by jquery.– EarlyZhao
Mar 6 at 6:32
@wentaohong Do you use turbolinks?
– Vasilisa
Mar 6 at 15:44
@wentaohong Do you use turbolinks?
– Vasilisa
Mar 6 at 15:44
Thanks Vasilisa, turbolinks is the solution.
– wentao hong
Mar 7 at 0:06
Thanks Vasilisa, turbolinks is the solution.
– wentao hong
Mar 7 at 0:06
|
show 1 more comment
1 Answer
1
active
oldest
votes
My solution is to use turbolinks.
$(document).on( 'turbolinks:load', function()
$('.questions').sortable();
);add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55015596%2fwhy-my-sortable-function-does-not-work-in-rails%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
My solution is to use turbolinks.
$(document).on( 'turbolinks:load', function()
$('.questions').sortable();
);add a comment |
My solution is to use turbolinks.
$(document).on( 'turbolinks:load', function()
$('.questions').sortable();
);add a comment |
My solution is to use turbolinks.
$(document).on( 'turbolinks:load', function()
$('.questions').sortable();
);My solution is to use turbolinks.
$(document).on( 'turbolinks:load', function()
$('.questions').sortable();
);$(document).on( 'turbolinks:load', function()
$('.questions').sortable();
);$(document).on( 'turbolinks:load', function()
$('.questions').sortable();
);answered Mar 8 at 0:07
wentao hongwentao hong
163
163
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55015596%2fwhy-my-sortable-function-does-not-work-in-rails%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
are you getting any error in web console?
– Vishal
Mar 6 at 4:58
No error in console
– wentao hong
Mar 6 at 5:38
Maybe lack of some libraries. As i know the
$('.sort').sortable()was implemented by jquery.– EarlyZhao
Mar 6 at 6:32
@wentaohong Do you use turbolinks?
– Vasilisa
Mar 6 at 15:44
Thanks Vasilisa, turbolinks is the solution.
– wentao hong
Mar 7 at 0:06