Coffeescript coffee脚本语法问题
这个咖啡剧本有什么问题吗?这把小提琴很好用 但当我试图将其转换为咖啡脚本时,它似乎不想工作Coffeescript coffee脚本语法问题,coffeescript,Coffeescript,这个咖啡剧本有什么问题吗?这把小提琴很好用 但当我试图将其转换为咖啡脚本时,它似乎不想工作 $(document).on "change", "#print_size_options_LargeFormatBlackWhite", (event) -> selected = undefined index = undefined selected = $(this).val() index = $("select").index(this) if selected i
$(document).on "change", "#print_size_options_LargeFormatBlackWhite", (event) ->
selected = undefined
index = undefined
selected = $(this).val()
index = $("select").index(this)
if selected is "customSize"
$($(".custom_size")[index]).fadeIn()
else
$($(".custom_size")[index]).fadeOut()
我能看到的唯一区别是,当使用小提琴时,您在这里编写(事件)是(evt)
您是否正在考虑将其用于转换?您的小提琴存在一些问题
$(".print_size_options_LargeFormatBlackWhite").change ->
selected = $(this).val()
index = $("select").index this
func = if selected is ".custom_size" then 'fadeIn' else 'fadeOut'
$($('.custom_size')[index])[func]()