I load a content to <div id="wrapper"></div>
via jquery.
$('#wrapper').html(data);
When the content inserted into wrapper, there is another div with id="video1"
.
How can I append something to that id="video1"
$('#video1').append('<p>Test</p>');
对于演示,我在这里附加了p
。
You can find the div by its ID in 'wrapper' after you insert it using .find
$('#wrapper').html(data).find("#video1").append(<Your Data Here>);
$('#wrapper').html(data);
$('#video1').html("new data");
try this,
$('#wrapper').find('#video1').append('thingsYouWant');
OR
$('#wrapper').html(data);
$('#video1').append('thingsYouWant');
you can directly use id selector to get the element after the element is added to the DOM
This would definitely work:
$('#wrapper').html(
$('<div>').attr({'id':'video1'})
);
Apparently, it is not possible to add something dynamically, eg content, to something that is considered static (as to my knowledge, could be wrong).
So, either you write it manually or you make some sort of automatisation...meaning JS for example.
So, the answer would be no, to all those questions/question.
Regards
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.