Skip to content

Instantly share code, notes, and snippets.

@cpoDesign
Created February 23, 2015 11:02
Show Gist options
  • Select an option

  • Save cpoDesign/eb54a606c17b96e41d75 to your computer and use it in GitHub Desktop.

Select an option

Save cpoDesign/eb54a606c17b96e41d75 to your computer and use it in GitHub Desktop.
JS - Example of replacing text with html
<div id="parent"> Text to update
<div>Child1</div>
<div>Child2</div>
<div>Child3</div>
<div>Child4</div>
</div>
$(function() {
$('input[type=button]').one('click', function() {
var cache = $('#parent').children();
$('#parent').text('Altered Text').append(cache);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment