Reputation: 21
I'm not very familiar with JS and I was wondering how I could edit an element of a website using a bookmarklet
I was trying to change the value of 58 in the following code:
<span class="rbx-text-navbar-right" id="nav-robux-amount">58</span>
Yet I had no luck, as I had used different information from different sites.
Could someone please help me? If I'm not being specific enough, please tell me.
Upvotes: 2
Views: 2292
Reputation:
Set the URL of the bookmarklet to:
javascript:
(code)
in order to run JavaScript in a bookmarklet. In your case, you would want
javascript:document.getElementById("nav-robux-amount").innerHTML="59";
Replace 59 with your value. Then, whenever you click the bookmark the script should activate.
Break-down
javascript:
indicates that we are executing a script.document.getElementById("nav-robux-amount")
selects the correct element to modify..innerHTML
refers to the HTML code that is inside the element.="59";
completes the statement by changing .innerHTML to 59.Upvotes: 2