Reputation: 277
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"
Upvotes: 6
Views: 40029
Reputation: 1
Apparently, it is not possible to add something dynamically, e.g. 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
Upvotes: -2
Reputation: 352
This would definitely work:
$('#wrapper').html(
$('<div>').attr({'id':'video1'})
);
Upvotes: 0
Reputation: 36551
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
Upvotes: 0
Reputation: 73966
$('#video1').append('<p>Test</p>');
For demo, I have appended p
here.
Upvotes: 16
Reputation: 276536
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>);
Upvotes: 3