$(document).ready(function () { $(":button").click(function (e) { var element = e.target.id; $('#target').add(element).css("color", "aqua"); }); });
<html> <head> <title>adding element</title> </head> <body> <div id="target">This is Div element. Div is our target Element.</div> <p>This is paragraph element.</p> <b>This is bold element.</b> <h3>This is h3 element.</h3> <span>This is span element.</span><br /><br /> <input type="button" id="p" value="Add p to target"/> <input type="button" id="b" value="Add b to target"/> <input type="button" id="h3" value="Add h3 to target"/> <input type="button" id="span" value="Add span to target"/> <input type="button" value="Back To Normal" onclick="location.reload()" /> </body> </html>