Reputation:
Have 2 divs.
Here is code
<p style="text-align: center;">
<video id="preview" controls style="border: 1px solid rgb(15, 158, 238); height: 280px; width: 300px;" muted="muted" ;></video>
</p>
<input type="button" id="record" class="btn btn-default" style="background: #ffcf00; color: black; height: 40px;text-shadow: none" value="Запись" onclick="doTimer()"/>
<button id="stop" class="btn btn-default" style="background: #ffcf00; color: black; height: 40px;text-shadow: none" disabled>Остановить</button>
<div id="container" style="padding:1em 2em;"></div>
I need to replace preview with container
I wrote this
$('#preview').replaceWith('#container');
But it just paste word container instead of div
Where is mistake?
Upvotes: 0
Views: 73
Reputation: 9642
You have some error in your jquery code
you can use following code for this
$( "#preview" ).replaceWith($("#container"));
Upvotes: 1
Reputation: 11472
You are now appending the string #container
you need to actually get the html of that selector using html()
method, so your code should be:
$('#preview').replaceWith($('#container').html());
Upvotes: 2