Hi how can I replace tag value with greasemonkey. My script does not run until the page loads. even if I did run-at document-start Can you guide me how can I print correct to result div ?
// ==UserScript== // @name New Userscript // @namespace http://tampermonkey.net/ // @version 0.1 // @description replace in javascript! // @author Ben // @match *://*/* // @run-at document-start // ==/UserScript== (function() { 'use strict'; let cells = document.getElementsByTagName("span"); for (var i = 0; i < cells.length; i++) { cells[i].setAttribute("veri-client", "correct"); } })(); <span veri-client="wrong"></span> <div id="result"></div> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> <script> var svalue = $("span").attr("veri-client"); $( "#result" ).text( svalue ); </script> -- You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/greasemonkey-users. For more options, visit https://groups.google.com/d/optout.
