Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我可以将jQuery text()方法的内容设置为另一个.text()方法吗?_Jquery_Html - Fatal编程技术网

我可以将jQuery text()方法的内容设置为另一个.text()方法吗?

我可以将jQuery text()方法的内容设置为另一个.text()方法吗?,jquery,html,Jquery,Html,我在中有内容,我想在中显示它 是否可以在jQuery中的一行上执行此操作,而不使用text方法中的函数? 类似于$'p.secondLine'。文本$'p.firstLine' 是的,这是可能的。可以将一个元素的innerText设置为另一个元素的innerText 您没有在代码中调用文本。$'p、 secondLine'.text$'p.firstLine' …是否在文本方法中不使用函数?类似于$'p.secondLine'。文本$'p.firstLine';这毫无意义,尤其是因为它在文本中使

我在

中有内容,我想在

中显示它 是否可以在jQuery中的一行上执行此操作,而不使用text方法中的函数?


类似于$'p.secondLine'。文本$'p.firstLine'

是的,这是可能的。可以将一个元素的innerText设置为另一个元素的innerText

您没有在代码中调用文本。$'p、 secondLine'.text$'p.firstLine'

…是否在文本方法中不使用函数?类似于$'p.secondLine'。文本$'p.firstLine';这毫无意义,尤其是因为它在文本中使用了函数$。
$('p.secondLine').text($('p.firstLine').text());
//                                     ^^^^^^^