如何使用.css()将多个CSS样式添加到元素(How to add multiple CSS styles to an element with .css())
我知道如何使用jQuery和JavaScript为嵌套元素添加样式,但由于某些原因,我无法弄清楚如何将样式添加到深度嵌套元素。
我正在为我的网站使用WordPress,并在我尝试访问的元素周围添加了一堆div。
我正在尝试使用类名称
.bx-wrapper
来设置元素的样式。 不过,我只想设计嵌套在类.associate-wrapper
中的.associate-wrapper
。这是我目前的HTML:
<div class="row associate-wrapper"> <li id="black-studio-tinymce-16" class="widget"> <div class="textwidget"> <div class="row"></div> <div class="col-md-12 text-center"></div> <div class="col-md-12 text-center"> <div class="bx-wrapper"> <p>content....</p> </div> </div> </div> </li> </div>
这里是我目前非工作的 jQuery:
$('.associate-wrapper').find('.bx-wrapper').css('position', 'absolute', 'margin-top', '30px');
I'm aware on how to add styles to nested elements using jQuery and JavaScript but for some reason I can't figure out how to add a style to a deeply nested element.
I'm using WordPress for my site and it has added a bunch of divs around the element that I am trying to reach.
I am trying to style the element with the class name
.bx-wrapper
. However, I only want to style the.bx-wrapper
that is nested inside of the class.associate-wrapper
.Here is my current HTML:
<div class="row associate-wrapper"> <li id="black-studio-tinymce-16" class="widget"> <div class="textwidget"> <div class="row"></div> <div class="col-md-12 text-center"></div> <div class="col-md-12 text-center"> <div class="bx-wrapper"> <p>content....</p> </div> </div> </div> </li> </div>
And here is my current non-working jQuery:
$('.associate-wrapper').find('.bx-wrapper').css('position', 'absolute', 'margin-top', '30px');
原文:https://stackoverflow.com/questions/32467355
最满意答案
我要回答我自己的问题。
实际问题是控制字符在linux中用作分隔符(^ A)
在Java中,当我使用string.split(“\ u0001”)时,它正在工作。 同样将它传递给Spring批处理flatfileitemreader作为分隔符,它就像一个魅力。
谢谢尚卡尔。
I am going to answer my own question.
The actual issue was control character was used as delimiter in linux (^A)
In Java when i use string.split("\u0001") it was working. Also passing the same to Spring batch flatfileitemreader as delimiter it works like a charm.
Thanks Shankar.
相关问答
更多-
如果可用,请使用PassThroughLineMapper public class PassThroughLineMapper implements LineMapper
{ @Override public String mapLine(String line, int lineNumber) throws Exception { return line; } } Use PassThroughLineMapper if available else public ... -
Spring Batch - FlatFileItemReader \ 001分隔符问题(Spring Batch - FlatFileItemReader \001 delimiter issue)[2024-01-26]
我要回答我自己的问题。 实际问题是控制字符在linux中用作分隔符(^ A) 在Java中,当我使用string.split(“\ u0001”)时,它正在工作。 同样将它传递给Spring批处理flatfileitemreader作为分隔符,它就像一个魅力。 谢谢尚卡尔。 I am going to answer my own question. The actual issue was control character was used as delimiter in linux (^A) In Ja ... -
我猜你的文件中有隐藏的字符。 您可以按照此链接说明验证您的文件中是否包含以及哪些字符。 这个问题可以帮助你\ 001分隔符有关为分隔符选择正确值的问题 。 如建议您可以尝试传递"\u0001"而不是^A 更新: 实际错误是在打印整个堆栈跟踪时org.springframework.batch.item.file.transform.IncorrectTokenCountException:记录中找到的令牌数量不正确:预期39实际40 因为记录/行中的最后一个字段后跟分隔符而$不仅仅是$,所以有一个额外的令牌 ...
-
这允许我传递变量 @Bean @StepScope public FlatFileItemReader
dataLoadFileItemReader(@Value("#{jobParameters['myParam']}" String storeNameEntry) { ..etc.. } 最大的问题是你不能使用ItemReader来做这件事,你必须返回FlatFileItemReader,否则你会得到一个无法打开阅读器的错误。 这只发生在StepScope ... -
我不确定你的文件名是如何生成的,但也许你可以使用后期绑定来解决你的问题。 当需要的信息可用时,后期绑定允许您稍后实例化Spring Batch Bean。 要使用后期绑定,请使用“常规” FlatFileItemReader但使用“step”范围。 就像是: @Bean @StepScope public FlatFileItemReader
reader(@Value("#{jobExecutionContext['personneFile']}") String pathToD ... -
如何自定义Spring Batch DelimitedLineTokenizer(How to custom Spring Batch DelimitedLineTokenizer)[2023-08-11]
问题不在于您的标记器。 您需要做的是使用PatternMatchingCompositeLineMapper ( http://docs.spring.io/spring-batch/trunk/apidocs/org/springframework/batch/item/file/mapping/PatternMatchingCompositeLineMapper.html )。 这将允许您为每种线型创建一个模式,并将其与相应的LineTokenizer相关联。 您可以在我们的示例中看到此LineMapp ... -
spring批处理组验证来自FlatFileItemReader的输入行(spring batch group validate input lines from FlatFileItemReader)[2024-01-15]
Spring的FlatFileItemReader提供了一个跳过顶部和末尾的行数的功能。 使用它们解决了这个问题。 没有可用的代码,但是从读者作者文档中得到了答案。 https://docs.spring.io/spring-batch/trunk/reference/html/readersAndWriters.html Spring's FlatFileItemReader provides a feature to skip the number of line at the top and end. ... -
DelimitedLineTokenizer.setIncludedFields()应该是解决问题的正确调用。 要按位置包含在输出中的字段(从0开始)。 默认情况下,包含所有字段,但可以将此属性设置为仅从较大的集合中选择几个字段。 请注意,如果提供了字段名称,则其编号必须与包含的字段数相匹配。 DelimitedLineTokenizer.setIncludedFields() should be the right call to solve your problem. The fields to inc ...
-
使用FlatFileItemReader.linesToSkip属性设置注入作业参数值。
-
引用的问题解决为wont-fix。 这意味着他们没有看到这个问题的必要性。 但我想建议您使用像这样的解决方法策略来实现您自己的Tokenizer类(可能扩展AbstractLineTokenizer )。 The referenced issue is resolved as wont-fix. This means they don't see the necessity of this issue. But I guess you are recommended to implement your ow ...