首页 \ 问答 \ stuff.className.indexOf(“term”)== 1不起作用(stuff.className.indexOf(“term”) == 1 not working)

stuff.className.indexOf(“term”)== 1不起作用(stuff.className.indexOf(“term”) == 1 not working)

我做了一些谷歌搜索,我发现以下代码不起作用,因为inputs [i] .className不是一个字符串。 我将如何使这个字符串? 我试过toString()。 另外,inputs.length不是0.我检查。

for (var i = 0; i < inputs.length; i++)
{
     if (inputs[i].className.indexOf("blah") == 1)
     {
      //do something
     }
}

我想只使用类名为“blah 1; 2; 3; 4”的输入数组值。

任何帮助,将不胜感激。


I did a bit of Googling, and I found that the following code does not work because inputs[i].className is not a string. How would I make this a string??? I tried toString(). Also, inputs.length is not 0. I checked.

for (var i = 0; i < inputs.length; i++)
{
     if (inputs[i].className.indexOf("blah") == 1)
     {
      //do something
     }
}

I want to do something with only the inputs array values that have a class name of something like "blah 1;2;3;4".

Any help would be appreciated.


原文:https://stackoverflow.com/questions/13428372
更新时间:2022-07-08 19:07

最满意答案

如果你想获得以前的值,你应该使用before触发器而不是after触发器。

触发时间是在过程中发生的阶段。 这可以是BEFORE或AFTER。 如果在此之前使用,则意味着触发器代码将能够处理当前存储在原始状态和新值中的值

MySQL触发器:触发时间


If you want to get the previous value, you should use a before trigger instead of an after trigger.

The trigger time is at what stage during the process takes place. This can be either BEFORE or AFTER. If using before this means that the trigger code will be able to work with both the values currently stored in there original state and the new values

MySQL Triggers : Trigger time

相关问答

更多
  • 如果你想获得以前的值,你应该使用before触发器而不是after触发器。 触发时间是在过程中发生的阶段。 这可以是BEFORE或AFTER。 如果在此之前使用,则意味着触发器代码将能够处理当前存储在原始状态和新值中的值 MySQL触发器:触发时间 If you want to get the previous value, you should use a before trigger instead of an after trigger. The trigger time is at what sta ...
  • 如动态sql / Prepared语句所述,这是不可能的。 它将生成Error Code: 1336. Dynamic SQL is not allowed in stored function or trigger 。在尝试甚至CREATE TRIGGER时, Error Code: 1336. Dynamic SQL is not allowed in stored function or trigger 。 关于最接近自动化的是使用CREATE EVENT 。 事件是按照您选择的计划/间隔运行的计划存 ...
  • 问题出在这一行: DECLARE VARIABLE NEW_TYPE_ID; 您尚未指定NEW_TYPE_ID的类型,因此该语句不完整,并且该位置的分号是意外的,这会导致令牌未知错误。 DECLARE VARIABLE的语法是: DECLARE [VARIABLE] { | | TYPE OF { | COLUMN } [NOT NULL] [CHARACTER SET ] [COL ...
  • 不幸的是,它是触发器中的逐列比较 编辑:由于不保证100%的准确性,您可以使用CHECKSUM(*) 。 HashBytes更好 Unfortunately, it is a column by column comparison in the trigger Edit: for not guaranteed 100% accuracy, you can use CHECKSUM(*). HashBytes is better
  • 你可以设置 Select STH into the_last_inserted_id from TBL limit 1; insert into examination_data (ed_cs_id,ed_examination_id) select cs_id,the_last_insert_id from class_students where cs_class_id = 1 AND cs_year_id = 1; 编辑:@ - 你正在使用而没有声明,只是设置 Select STH into @ ...
  • 下面的代码对我来说有一些快速测试。 也许它可以满足您的需求。 实际的触发器部分可能是你真正需要的,其余的我用来测试。 这样写的方式,它只会更新当前和相关的记录(当时正在更新的记录)。 连接到inserted表可确保发生这种情况。 使用插入和删除的表(MSDN) CREATE TABLE EmpLog (EmpID int, ShiftStart time, Shiftend time, LogDate date, TotalMinutes decimal(18,2)); GO -- Trigger sta ...
  • 有一些小格式错误。 以下可能会被使用,或者: CREATE OR REPLACE TRIGGER Fee_Trigger AFTER UPDATE ON CHARTER FOR EACH ROW WHEN ((NEW.Return_Date <> OLD.Return_Date AND NEW.Return_Date IS NOT NULL)) DECLARE Fee NUMBER; BEGIN Fee := :NEW.Return_Date - :NEW.Due_Date; IF F ...
  • 答案是UPDATE事务整体失败。 在tableA.column1更新时,tableA上配置的更新触发器被设计为在tableB上插入新行。 insert语句包含一个在tableB上设置为PK的列。 显然,插入语句不能在PK列中插入重复值,所以整个更新都是轰炸。 对我来说,解决方案是从tableB.PK中删除PK属性。 这是一个审计表,所以我不应该错过它。 谢谢 The answer is that the UPDATE transaction was failing as a whole. The updat ...
  • 那么这可能不是最佳选择,但解决此问题的一种方法是使用临时表来存储更改的机器,然后加入到已插入或已删除的表中。 如: ALTER TRIGGER [dbo].[tr_StatusChange_tblMachine] ON [dbo].[tblMachine] AFTER UPDATE AS BEGIN SET XACT_ABORT ON; SET NOCOUNT ON; SET ROWCOUNT 0; CREATE TABLE #tmp(MachineName nvarchar(50), NewStat ...
  • 您不需要删除列或索引,只需删除并重新创建触发器并更新任何更改的字段。 使用常规DROP TRIGGER语句DROP TRIGGER ,然后使用tsvector_update_trigger使用新列重新创建它,所有这些都在同一事务中。 现在UPDATE tablename SET user_tsv = ... WHERE new_column IS NOT NULL ,如果您已经添加了列,则更新列。 检查tsvector更新触发器的源以找出要在分配中使用的适当表达式。 You don't need to dr ...

相关文章

更多

最新问答

更多
  • 您如何使用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)