首页 \ 问答 \ Jquery更改事件在coffeescript中不起作用(Jquery change event not working in coffeescript)

Jquery更改事件在coffeescript中不起作用(Jquery change event not working in coffeescript)

嘿家伙我刚刚尝试在coffeescript中实现我的更改事件,但它不起作用。 请问有什么帮助

$('#subscription_id").on "change", -> 
console.log "Hello"
outputs = $(this).val()

if outputs
 $('#subscription_id').prop "disable", "false"
 $('##subscription_id').prop "disable", "true"

hey guys I have just try to implement my change event in coffeescript but its not working. Will any help me

$('#subscription_id").on "change", -> 
console.log "Hello"
outputs = $(this).val()

if outputs
 $('#subscription_id').prop "disable", "false"
 $('##subscription_id').prop "disable", "true"

更新时间:2021-06-07 07:06



$('#subscription_id").on "change"


$('#subscription_id').on "change"

The colors indicate the problem :

$('#subscription_id").on "change"

Should probably be

$('#subscription_id').on "change"



Rails 4- coffeescript没有部分执行(Rails 4— coffeescript not executing in partial)

如果它是一个AJAX响应,那么你不需要$(document).ready()。 页面首次加载时会触发,但我相信每次收到回复时都不会再次触发。 Unbelievable but apparently the problem was that the jQuery ajax function that was calling the controller action was defaulting to dataType: 'json' -- this made everything work as ...

Coffeescript点击事件没有解雇?(Coffeescript on click event not firing?)

1)您需要将您的ID更改为有效的ID(阅读此文章 ),例如start_quizz_button 2)使用id-selector # : $(document).on('turbolinks:load', -> $('#start_quizz_button').on 'click', -> console.log "[AC] on click handler called!") 1) You need to change your id to a valid one (read this post ...

Jquery更改事件在coffeescript中不起作用(Jquery change event not working in coffeescript)

颜色表明问题: $('#subscription_id").on "change" 应该是 $('#subscription_id').on "change" The colors indicate the problem : $('#subscription_id").on "change" Should probably be $('#subscription_id').on "change"

CoffeeScript无法处理Rails 4应用程序中的下拉菜单(CoffeeScript not working on dropdown menus in Rails 4 application)

改变这个: ("optgroup[label='#{Muscle group}']") 对此: ("optgroup[label='#{muscle_group}']") Change this: ("optgroup[label='#{Muscle group}']") to this: ("optgroup[label='#{muscle_group}']")

Jquery更改事件不起作用(Jquery change event not working)

尝试使用此代码。 $('#fileupload').on('change', function () { alert('Hi'); //do your function. }); 此功能只会调用您选择的其他文件,否则不会。 try to use this code. $('#fileupload').on('change', function () { alert('Hi'); //do your function. }); this function will ...

coffeescript / jquery / rails不能用于:layout => false [复制](coffeescript/jquery/rails doesn't work with :layout => false [duplicate])

既然你告诉我们你没有渲染布局: 注意:您可能在布局文件中包含了jquery文件 - >如果没有渲染,没有jquery,你的javascript就行不通! Since you told us that you are not rendering a layout: Take care: Probably you include the jquery-files in your layout file -> if its not rendered, there is no jquery and you ...

CoffeeScript点击事件不起作用(CoffeeScript on click event not working)

您需要在脚本之前添加对jQuery JavaScript库的引用 <body> <div id='button'></div> <script src='/path/to/jquery-3.1.1.min.js'></script> <script src='first.js'></script> </body> 您需要将jQuery下载到您的系统并提供正确的路径。 You need to add a reference to the jQuery javascript ...

coffeescript返回(coffeescript return)

似乎CoffeeScript编译器不会隐式返回null,除非它需要阻止以后的代码执行。 如果在该代码之后发生了某些事情,它将添加null返回,例如: if @isShown or event.isDefaultPrevented() return alert(1) // compiles to => if (this.isShown || event.isDefaultPrevented()) { return; } alert(1); 而在上面的例子中,函数只会在条件之后退出, ...

如何在jquery中使用coffeescript?(how can I use coffeescript with jquery?)

这是一个例子...... HTML <!DOCTYPE html> <body> <a class='button' href='#'>Click Me</a> </body> </html> CoffeeScript的 $ -> $('.button').click (event) -> console.log 'button clicked' 点击此处查看实例 Here's an example… HTML <!DOCTYPE html> <body> ...

将jQuery转换为Coffeescript(Translating jQuery to Coffeescript)

JavaScript版本有两个不同之处: ).$('#customers').on( 'search.dt', $('.nested_indent').hide() ) 首先是. 在$('#customers') 。 这会尝试使用$作为方法而不是全局。 你想要删除. 并插入带有匹配缩进的换行符。 第二个是缺少$('.nested_indent').hide()周围的function 。 你必须至少包括->来定义一个,就像你使用jQuery -> 。 ) # 1) separate ...




  • 如何从远程文件拉取文件而不覆盖本地文件?(How do I pull files from remote without overwriting local files?)
  • Reactjs:状态改变时重新渲染iframe(Reactjs: re-renders iframes when state changed)
  • 奇怪的网址,以及跟随php页面流程的困难(odd url, and difficulty in following the php page flow)
  • 标签活动无效(Tab Activity is not working)
  • JavaME合适的语法编译器建议?(JavaME-suitable grammar compiler recommendations?)
  • 指定参数(Specifying arguments)
  • 可以通过Ruby插件或控制台覆盖Sketchup中的键盘快捷键吗?(Can one override keyboard shortcuts in Sketchup through the a Ruby Plugin or Console?)
  • 计算Java EE Web App中用户数的最佳方法(Best way to count number of users in a Java EE web App)
  • 无法使用templateUrl加载cordova中的外部模板(unable to load external templates in cordova with templateUrl)
  • PHPExcel:写入期间无法使用缓存(PHPExcel: Unable to use cache during write)
  • 在javascript中嵌套这个指针(nested this pointer in javascript)
  • 谁跟领航致远培训过,有问题问下啊
  • 控制器要求在入门时下载(Controller ask to download on entry)
  • 未能通过conda安装Asyncio(Failure to install Asyncio via conda)
  • 如何查找已完成项目的总长度?(How to find length of total completed items?)
  • 如何检查OleInitialize是否已被调用?(How to check if OleInitialize has already been called?)
  • SQL在特定范围内返回列中具有最大值的行(SQL Returning rows with max value in column, within a specific range)
  • preg_match从url获取id(preg_match get the id from url)
  • 如何在运算符中为make方程转换perl变量?(How to convert a perl variable in a operator for make equations?)
  • 在导航上方添加空格/标题。(Add a white space/ header above navigation.)
  • MeetingItem已保存;(MeetingItem saved; but change now shown in Calendar)
  • c#vb:我们应该使用System.Lazy进行资源密集型任务吗?(c# vb: Should we use System.Lazy for resource-intensive task? (when threading is not needed))
  • 为什么在armeabi代码中使用armeabi-v7a代码?(Why use armeabi-v7a code over armeabi code?)
  • 获取请求的自定义标头(Java HTTP)(Fetching a custom header of a request (Java HTTP))
  • 是否可以在嵌套的if语句中从varchar转换为numeric以动态评估参数?(Is it possible to convert from varchar to numeric within a nested if statement in order to dynamically evaluate a parameter?)
  • 如何将Html.ActionLink转换为链接到Ajax调用的按钮?(How to convert from Html.ActionLink to a button linked to Ajax call?)
  • 应用程序如何处理Windows符号链接?(How are Windows symbolic links treated by the apps?)
  • html,js,css在jsfiddle中工作,但不在sharepoint中(html, js, css works in jsfiddle but not in sharepoint)
  • 从Ruby脚本调用Elasticsearch Rest API(Calling Elasticsearch Rest API from Ruby script)
  • 如何将嵌套setTimeouts转换为承诺(How to convert nested setTimeouts to promises)