操纵H1标签(Manipulation H1 Tag)
我有以下问题:
<h1 id="title">Text Text Text <br> Second Text Text Text </h1>
如何在break-Tag之后更改或操作Text?
我无法改变HTML本身 ,它必须通过包含jQuery的JavaScript来完成。
操作后它应该如下所示:
<h1 id="title">Text Text Text <br> <span id="preTitle"> blablabla </span></h1>
有人解决了这个问题吗? 提前致谢
I have the following Problem:
<h1 id="title">Text Text Text <br> Second Text Text Text </h1>
How can i change or manipulate the Text after the break-Tag ?
I cant change the HTML itself and it has to be done via JavaScript containing jQuery.
After manipulating it should look like this:
<h1 id="title">Text Text Text <br> <span id="preTitle"> blablabla </span></h1>
Anybody got a solution to this? Thanks in advance
原文:https://stackoverflow.com/questions/29228227
最满意答案
你有两个选择:
使用
.
运算符将变量连接成字符串:set title "Secondary structure CA IX residues " . first . " to " . lines
我在
"
和.
之间添加了空格.
为了清楚起见,这些将不会在输出中显示。您负责在字符串部分中添加适当的空格。按预期使用
sprintf
:set title sprintf("Secondary structure CA IX residues %d to %d", first, lines)
sprintf
的第一个参数是格式字符串,不应包含任何变量。 占位符(例如%d
)用于指示应插入变量的位置。 函数的后续参数是要插入的变量。 由于您的两个变量似乎是整数,因此%d
是要使用的相应格式说明符。You have two options:
Use the
.
operator to concatenate your variables into strings:set title "Secondary structure CA IX residues " . first . " to " . lines
I have added in spaces between the
"
and.
for clarity, these will not be featured in the output. You are responsible for adding in the appropriate spaces in the string sections.Use
sprintf
as it was intended:set title sprintf("Secondary structure CA IX residues %d to %d", first, lines)
The first argument to
sprintf
is a format string, which should not contain any variables. Placeholders (such as%d
) are used to indicate the positions that variables should be inserted. Subsequent arguments to the function are the variables to be inserted. As your two variables appear to be integers,%d
is the appropriate format specifier to use.
相关问答
更多-
在文本上使用替代或标题(use alt or title on text)[2023-03-19]
对于一般文字, difficult part 对于首字母缩写词,您可以使用 The FWHM wavelength is... For general text, difficult part For acronyms, you ... -
gnuplot中的粗体增强文本(bold enhanced text in gnuplot)[2023-08-11]
从5.0版开始,gnuplot有一个新的语法来处理这个问题: "normal text {/Times:Bold boldface-newfont} {/:Italic slanted-default-font } back to normal text"] 这些括号也可以嵌套。 Since version 5.0, gnuplot has a new syntax to handle this issue: "normal text {/Times:Bold boldface-newfont} {/ ... -
sprintf应该提供所需的全部功能,例如, plot for [i=0:10] .... t sprintf(" = %.1f", 0.5*i) 为了使用0.5*i的值和1个十进制数字...... sprintf should provide all the functionality needed, e.g., plot for [i=0:10] .... t sprintf(" = %.1f", 0.5*i) in order to use the value of 0.5*i with 1 de ...
-
通过-e将变量传递给gnuplot会导致不持久的窗口(Passing variable to gnuplot via -e causes not persistent window)[2023-08-24]
我已经定义了这个别名alias gnuplot='rlwrap -N -a -c -b"\"\"\\'\''\\'\''" gnuplot'在unalias gnuplot它可以工作。 I have defined this alias alias gnuplot='rlwrap -N -a -c -b"\"\"\\'\''\\'\''" gnuplot' After unalias gnuplot it works. -
我试试 var result = Regex.Split(input, @" (?=Mr\b|Mrs\b|Ms\b)", RegexOptions.None); 如果每个头衔确实是“先生”,“夫人”或“女士”之一。 这种方法允许相当多的不寻常的姓氏,但需要提前知道每个标题。 在ideone.com上查看它的实际操作 I'd try var result = Regex.Split(input, @" (?=Mr\b|Mrs\b|Ms\b)", RegexOptions.None); if every t ...
-
使用动态SQL DECLARE @TESTTEXT varchar(200) SET @TESTTEXT = '101,103,104' exec('SELECT 1 WHERE ''101'' IN ( ' + @TESTTEXT + ')') use dynamic SQL DECLARE @TESTTEXT varchar(200) SET @TESTTEXT = '101,103,104' exec('SELECT 1 WHERE ''101'' IN ( ' + @TESTTEXT + ') ...
-
将文本分隔为R中的变量(Separate text to variables in R)[2022-02-20]
您可以使用read.table ,但是您应该使用count.fields或某种正则表达式来首先计算出正确的列数。 使用Robert的“文本”示例数据: Cols <- max(sapply(gregexpr("+", text, fixed = TRUE), length))+1 ## Cols <- max(count.fields(textConnection(text), sep = "+")) read.table(text = text, comment.char="", header = FA ... -
我没想到的是它也会选择像第三个例子那样的文本出现在它们之间的案例。 相邻的兄弟组合子+不考虑文本。 它只会选择紧随其后的兄弟元素。 您可以根据前一个兄弟元素是元素还是空格来过滤所有相邻的em元素,如果文本出现在标记之间,则排除元素。 在下面的示例中,未选择第三个p的em ,因为前一个节点是文本。 var $previousSiblings = $('em + em').filter(function () { var prev = this.previousSibling; return p ...
-
r中的标题和文本格式 - 同时使用变量和上标(title and text formatting in r - use simultaneously variables and superscript)[2022-05-10]
bquote可能的解决方案: plot(1:10, 1:10) title(main = bquote(.(number[1]) ~ "plot, units are in km" ~ m^-3)) A possible solution with bquote: plot(1:10, 1:10) title(main = bquote(.(number[1]) ~ "plot, units are in km" ~ m^-3)) -
你有两个选择: 使用. 运算符将变量连接成字符串: set title "Secondary structure CA IX residues " . first . " to " . lines 我在"和.之间添加了空格.为了清楚起见,这些将不会在输出中显示。您负责在字符串部分中添加适当的空格。 按预期使用sprintf : set title sprintf("Secondary structure CA IX residues %d to %d", first, lines) sprintf的第一 ...