dan dan - 4 months ago 18
jQuery Question

delete text without element inside div after some button

here the code

class="alert alert-danger col-md-offset-1 col-md-10 alert-dismissible"
<button type="button" class="close" data-hide="alert" aria-hidden="true">
<span aria-hidden="true">&times;</span>
myquestion is,, how to remove/delete this text using jquery, just this text only,,

i've tried
$('#user-alert :not(:first-child)').remove();
but it won't work

i also tried
$('#user-alert button.close).text('')
still not work


Try this UPDATED

$( "#YourIdHere" ).contents().filter(function() {
  return this.nodeType === 3;