Summernote textarea change YouTube URL into <iframe> using this code :
$video = $('<iframe>')
.attr('src', '//www.youtube.com/embed/' + youtubeId)
.attr('width', '640').attr('height', '360');
and it turns the YouTube URL into this :
<iframe src="//www.youtube.com/embed/_qxxxxxxc" width="640" height="360" frameborder="0"></iframe>
but I want to insert bootstrap responsive class, so it will end like this :
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="//www.youtube.com/embed/_qxxxxxxc" frameborder="0"></iframe>
I tried to modify the javascript like this :
$video =
$('<div>').attr('class','embed-responsive embed-responsive-16by9');
$('<iframe>')
.attr('class', 'embed-responsive-item')
.attr('src', '//www.youtube.com/embed/' + youtubeId)
.attr('width', '640').attr('height', '360');
and it end up like this as result :
<div class="embed-responsive embed-responsive-16by9" frameborder="0"></div>
how to keep the iframe and add div element? thank you.