how to change onclick attribute in javascript code example Example: Change onClick attribute of html tag $("#id").attr("onclick","new_function_name()");