jQuery, Attributes and Content: Get & Set Content, 3rd page | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

jQuery, Attributes and Content: Get & Set Content, 3rd page

If I am not mistaken, the example code: $(function() { $("#test").text("hello!"); }); will result in: <div id="test">hello!</div> and not in: <div id="test"> <p>hello!</p> </div> What is targeted and modified is the div and not the paragraph...

31st May 2018, 1:21 PM
Jiří Bočan
1 Answer
+ 1
thats for your selector path. you should get '#test p', then change text of that
5th Jun 2018, 9:34 PM
Mohammad Mehdi Takalloo
Mohammad Mehdi Takalloo - avatar