Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

View source is so 2006, cool kids use the Javascript console to modify web pages as they please.

    document.body.innerHTML = document.body.innerHTML.replace(/<!--|-->/g,'')


What's the js to make a site editable with your cursor (you can click on text in a <p> and then you get a cursor in it where you can insert more text, also changes your mouse cursor to indicate that you can edit, over text)? I saw it here on hn once in the comments, but then I couldn't find it again later when I needed it. (I had also saved it in a vim window but forgotten to save it, ugh!)


javascript:document.body.contentEditable='true';document.designMode='on';void 0


$(body).html().replace(/<!--|-->/g,'');


Multiple errors, it should be:

    $("body").html(function(i,h){return h.replace(/<!--|-->/g,'')})
jQuery is awesome (is even my nickname!) but sometimes plain Javascript does the trick pretty well.


yea i tried it in the firefox console after i posted it. it felt wrong and lol it was




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: