首页 \ 问答 \ Jquery&Ruby - 切换功能不起作用(Jquery & Ruby - Toggle function not working)

Jquery&Ruby - 切换功能不起作用(Jquery & Ruby - Toggle function not working)

有人可以告诉我为什么我的javascript代码不起作用

在此处输入图像描述

我正在使用gem simple_form,我想要做的是:

  • 当用户点击红色框(如图中所示)时,空的红色框图像应更改为勾选框
  • 我有2个CSS图像; img-checkbox-notick.png(无勾选框图片)&img-checkbox-tick.png(勾选框图片)

我正在使用javascript / toggle

new.html.erb

<div class="checkbox custom">
    <%= f.input :remember_me, input_html: { class: 'css-checkbox' }, label_html: { class: 'css-label-notick' }, as: :boolean if devise_mapping.rememberable? %>
 </div>

javascript文件

$(document).ready(function() {
  $('.css-label-notick').on('click', function (e) {
      $('.css-label-notick').toggleClass(".css-label-tick");
  });
});

我已在红色突出显示的图像中显示输入的详细信息

css文件

.css-label-notick {
  background: url("img-checkbox-notick.png") no-repeat;
  height: 65px;
}

.css-label-tick {
  background: url("img-checkbox-tick.png") no-repeat;
  height: 65px;
}

任何建议将不胜感激 - 非常感谢


Could one kindly advise me why my javascript code is not working

enter image description here

i am using the gem simple_form, what i am trying to do is:

  • when a user clicks on the red box (as displayed in the image) the empty red box image should change to a tick box
  • i have 2 css images; img-checkbox-notick.png (none tick box image) & img-checkbox-tick.png (tick box image)

i am using javascript / toggle

new.html.erb

<div class="checkbox custom">
    <%= f.input :remember_me, input_html: { class: 'css-checkbox' }, label_html: { class: 'css-label-notick' }, as: :boolean if devise_mapping.rememberable? %>
 </div>

javascript file

$(document).ready(function() {
  $('.css-label-notick').on('click', function (e) {
      $('.css-label-notick').toggleClass(".css-label-tick");
  });
});

i have displayed the details of the input within the image highlighted in red

css file

.css-label-notick {
  background: url("img-checkbox-notick.png") no-repeat;
  height: 65px;
}

.css-label-tick {
  background: url("img-checkbox-tick.png") no-repeat;
  height: 65px;
}

any advise would be much appreciated - many thanks


原文:https://stackoverflow.com/questions/32320791
更新时间:2022-02-20 15:02

最满意答案

每次执行时都会在开头设置指针。

ldi ZH,high(BCDTo7_Seg << 1)
ldi ZL,low(BCDTo7_Seg << 1)

Every time it executes it sets pointer at the beginning.

ldi ZH,high(BCDTo7_Seg << 1)
ldi ZL,low(BCDTo7_Seg << 1)

相关问答

更多
  • 每次执行时都会在开头设置指针。 ldi ZH,high(BCDTo7_Seg << 1) ldi ZL,low(BCDTo7_Seg << 1) Every time it executes it sets pointer at the beginning. ldi ZH,high(BCDTo7_Seg << 1) ldi ZL,low(BCDTo7_Seg << 1)
  • 是的,这是可能的。 将--gc-sections传递给链接器将指示它省略未引用的部分。 此外,将-ffunction-sections和-fdata-sections标志传递给编译器将指示它为每个函数和变量生成一个部分,从而使这些部分在单独的基础上而不仅仅是在文件级别上。 Yes, this is possible. Passing --gc-sections to the linker will direct it to omit sections which are not referenced. Ad ...
  • Intel十六进制使用字节地址。 PC程序计数器是指16位字地址。 如果您的单词地址是“实际地址”,那么只需加倍表示十六进制文件中该行起始地址的数字即可。 “复杂的内存结构”是什么意思? 无论地址空间如何分解,内存位置都需要唯一的地址。 我不熟悉程序存储器空间不以0开头并且线性延续,但如果有这样一个方案,intel hex文件中的一行可以指定从任何地址开始的任何连续存储器部分的内容。 编辑: intel hex文件的每行只能包含最多255个字节。 通常,数据被分成16或32字节的块。 每行包含块的起始地址( ...
  • 是的, tst chdir; brmi right tst chdir; brmi right看第7位,因为那是符号位。 当然有很多方法可以将其更改为#0位,但最简单的方法是使用bst和T标志: bst chdir, 0 ; copy bit to T flag, use any bit number you like brts right ; use brtc to reverse condition Yes, the tst chdir; brmi right looks at bit #7, b ...
  • 如果要在atmel studio中跟踪EEPROM,则需要启动调试会话并打开存储器窗口(Alt + 6)。 应该有下拉列表在哪里应该是eepom选项。 你可以在那里验证你的数据。 If you want to track EEPROM in atmel studio, than you need to start debug session and open memory window (Alt+6). There should be drop down list where should be eepom ...
  • 现在我解决了。 串行缓冲区的大小有问题。 我把它的大小增加到128个字节,现在工作正常。 Now i solved it. There is problem with size of serial buffer. I increased it's size to 128 bytes and its working fine now.
  • 我认为你没有执行所需的init序列。 在lcd_init()您首先发送函数集。 但是,显示器在此之前等待一个序列,如下所示: 我不确定如何使用4位接口处理,但我认为这就是为什么DB3-0“不关心”。 您可能只需要在4位总线上应用DB7-4(阅读数据表)。 我会在启动时等待几百毫秒,以确保Vcc稳定。 然后按照放松的时间跟随重置序列 打开 等待200ms 发送说明 等待20ms 发送说明 等待5ms 发送说明 等待5ms 发送功能集 ... 由于您没有轮询忙碌标志,我将在所有以下指令之间等待至少1ms。 I ...
  • delay函数中有一个无限循环。 介意使用: delay: ldi r16, 0xFF delay_loop_1: dec r16 brne delay_loop_1 ret You have an infinite loop in your delay function. Mind using: delay: ldi r16, 0xFF delay_loop_1: dec r16 brne delay_loop_1 ret
  • 嗯..在Spi编程模式下有加载和写入指令。 首先,它们之间有什么区别? 您可能不知道“页面缓冲区”。 要将新数据写入页面,必须首先填充页面缓冲区。 它持有一个临时页面,必须逐字填写。 - >加载指令 缓冲区在一次操作中复制到闪存。 - >写指令 第二个问题是关于加载内存页面指令。 有两条指令:一条用于低字节,一条用于高电平。 我们必须发送四个字节:命令标识字节(如果我可以这样调用它),地址的MSB,地址的LSB和数据字节。 问题到底是什么指示呢? 虽然我们加载了由128个字节组成的页面,但这里的高低字节是什 ...
  • Bit 8位AVR系列基于(经过修改的)哈佛架构,您可以在其中拥有专用的程序和数据存储。 程序存储器的数据路径确实是16位,而数据存储器仅为8位。 有趣的是,Atmel在开始时指出,这些是8位CPU。 与其他8位产品(如8051或Rabbit)相比,这使它们看起来非常具有竞争力。 由于16位程序数据路径,AVR在基准测试中表现非常出色。 后来,当8位听起来有点过时时,Atmel决定将它们称为8/16位CPU。 BitThe 8-bit AVR family is based on a (modified) ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)