I need to change iframe src on click. Due to some reason I wish to use event.target and not any other method.
I am trying to achieve the same using the below code but it is not working.
html code:
<div id="div2" class="sim-row-edit-video">
<iframe class="frame" width="auto" src="https://www.youtube.com/embed/tgbNymZ7vqY"></iframe>
</div>
I would rather not use class or id to change the same as there are many with similar class. Kindly use event.target.
js code:
$(".sim-row-edit-video").click(function(){
alert("video clicked");
$(event.target).attr('src', 'https://www.youtube.com/embed/drOnSwo1Ob0');
//event.target.src = 'https://cdn.iconscout.com/icon/free/png-256/car-location-find-navigate-gps-location-29571.png';
});
How can I change the src of the clicked iframe?