javascript - How to remove element using specific id -


i have html this:

<html>    <input type='button' name='button1' id='button1'>    <input type='button' name='button2' id='button2'> </html> 

what want when user click button2, should remove button1 element , show message on place. after button2 click event.

<html>    button1 removed    <input type='button' name='button2' id='button2'> </html> 

if use jquery, can that:

$('#button2').click(function() {   $('#button1').replacewith('button1 removed') }); 

Comments