What should I do if I want to change the value without an id?

Asked 2 years ago, Updated 2 years ago, 25 views

I'd like to add a text message in between What should I do?

I want to add it like this I tried to use document.getElementById() in JavaScript, but I don't know what to do because there is no id value.

javascript

2022-09-22 21:08

2 Answers

Try jQuery's prepend.

http://api.jquery.com/prepend/

$('body').prepend('sdsdsdsdsd');


2022-09-22 21:08

Hmm...You want to grab the P element, right?


 #('body > p:first').before("sdsdsdsdsd');

Reference URL: http://api.jquery.com/before/


2022-09-22 21:08

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.