jQuery replace

by shraddhapaghdar

HTML

<p>Welcome to jQuery!</p>
<button >
Change
</button>

JavaScript

$(document).ready(function () {
	$('button').on('click',() => {
    $("p").text((index, text) => {
  return text.replace("jQuery", "Delftstack");
  	});
  })
});