2016-09-10 6 views
-1

Ich möchte die SRC für iframe von href-Links festlegen.
Hier ist mein Code:jQuery set src Attribut für iframe mit Link href?

$(function(){ 
    $('.video-play').on('click',function(){ 
     var r= $('<iframe src="<!-- OF HREF LINKS -->" id="abc_frame" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'); 
     $("#inner-vid").append(r); 
    }); 
}); 

<a href="<!-- HERE IS MY LINK -->" class="video-play md-trigger" data-modal="modal--action-play"> 
+2

Also, was ist das Problem? Was hast du bisher versucht? [Wie man fragt] (http://stackoverflow.com/help/how-to-ask) – AgataB

+0

Ich versuche, das Valeo-Video mit dem Modal-Fenster zu zeigen. Ich habe eine Schaltfläche, um ein modales Fenster und div mit iframe-Quelle zu öffnen. '... var r = $ (''); ... ' Es funktioniert, aber es ist nicht bequem, und ich möchte das Video in der Schaltfläche Link war. –