I am unable to retrieve a username from a dynamic webpage using the wait function. However when I execute $("#label301354000").text();
in Chrome Developer tool, I get my username. Any idea how to tweak the function to capture the id value?
// ==UserScript==
// @name UI
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Test
// @author Dejan
// @match http://url/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.0
// @require https://gist.githubusercontent.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
/* jshint -W097 */
'use strict';
waitForKeyElements("#label301354000", getUser);
function getUser(jNode) {
console.log("User is "+ jNode.text() );
}