Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting .innerHTML

I am developing a Firefox extension which need to change some values on a specific <div>.

I try to inject this into the DOM by tying this into the URL bar:

javascript:document.getElementById('c4d9b2819218742680841961_input').innerHTML = 'foo'

The value do change but then the whole page become blank quickly expect the <div>.

How can I avoid this? Thanks.

like image 220
benone Avatar asked Dec 01 '25 16:12

benone


1 Answers

It is acting on the return value for of your code. Wrapping it in a void() will suppress this. This should work>

javascript:void(document.getElementById('c4d9b2819218742680841961_input').innerHTML = 'foo')
like image 172
Jeremy Avatar answered Dec 04 '25 05:12

Jeremy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!