jQuery append input value to iframe data-src

  iframe, input, javascript, jquery

How can I append an input value to data-src iframe in jQuery.

var input = $("#input").val();

var iframe = $(".win");
iframe.attr("src", iframe.data("src").join(input)); 
        
console.log(iframe.data("src"));

I am doing like the above snippet but the console.log returns only the initial value without the input value that should be appended.

Does anyone know a way to do it?

Source: Ask Javascript Questions

LEAVE A COMMENT