Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的目标是创建两个自动增长的列。问题是我想将第 1 列与第 2 列进行比较。 (即)如果 col1 内容 > col2 内容将内容添加到 col2 否则如果 col1==col2 将下一个内容添加到 col1 直到所有未知内容量都布置好。 如何跟踪列中的内容以便比较两列?
它看起来像这样,而不是数字,而是字符
如果您的内容是纯文本,请使用 jquery 使用两个类(col1 和 col2):
var co1=$('.col1').val(); var co2=$('.col2').val(); if(co1.length > co2.length) { $('.col1').append('some html'); }else if(co1.length <= co2.length){ $('.col2').append('some html'); }
在其他情况下,您也可以执行此方法。