Question

I will be running the javascript through my browser (chrome) like this javascript:codegoeshere, so i cannot use jQuery. The website is not mine, so i cannot modify it. In the source code of the web page the username is stored like this:

<div class="m-names"><div class="m-h3"><strong>@usernamegoeshere</strong>

My question is, how can i parse @usernamegoeshere with javascript into a variable? I want to be able to alert the final result. Thanks to anyone that can help.

Was it helpful?

Solution

Just use querySelectorAll

javascript:alert(document.querySelectorAll(".m-names .m-h3 strong")[0].innerHTML);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top