I have code to autofill form fields
(function( window ) {
"use strict";
var document = window.document,
fieldValueMap = {
"author" : "author"
, "name" : "name"
, "email" : "email@gmail.com"
, "url" : "url.link"
, "website" : "website.com"
, "comment" : "comment"
, "commentName" : "commentName"
, "commentEmail" : "commentEmail@gmail.com"
, "commentWebsite" : "commentWebsite.com"
, "commentComment" : "commentComment"
};
Object.keys( fieldValueMap ).forEach(function( name ){
var input = document.querySelector( "form input[id='" + name + "']" )
|| document.querySelector( "form select[id='" + name + "']" )
|| document.querySelector( "form textarea[id='" + name + "']" );
input && input.type !== "hidden" && ( input.value = fieldValueMap[ name ] );
});
})(window);
But it doesn't work properly when there is iframe on the website page. It works only when I'm manually choosing "evaluation context" and put the code in console. like that result
So I wonder if there is a way to automatize the process of filling forms in iframe and make the whole script work together. Perfectly I'd like to use final script as a bookmarklet. My first coding experience, found the code on the internet and customized it for my needs. I'm sorry if the question is too stupid. Any ideas?