Using the answer from this question:
$(elem)
.contents()
.filter(function() {
return this.nodeType == 3; //Node.TEXT_NODE
}).remove();
More Related Contents:
- jQuery find events handlers registered with an object
- Best way to remove an event handler in jQuery?
- jQuery Event : Detect changes to the html/text of a div
- jQuery table sort
- jQuery ‘input’ event
- Determine if $.ajax error is a timeout
- How to force a html5 form validation without submitting it via jQuery
- Clone isn’t cloning select values
- jQuery and MooTools Conflict
- jquery IE Fadein and Fadeout Opacity
- How can I check if a key is pressed during the click event with jQuery?
- Codeigniter session bugging out with ajax calls
- Use ASP.NET MVC validation with jquery ajax?
- jQuery AJAX calls in for loop [duplicate]
- wait for a jquery ajax callback from calling function
- How to read userData in jqgrid?
- Order of execution of jquery document ready
- Disable specific days of the week on jQuery UI datepicker [duplicate]
- Unobtrusive Ajax stopped working after update jQuery to 1.9.0
- jquery callback after all images in dom are loaded?
- jQuery $.animate() multiple elements but only fire callback once
- iOS Safari – How to disable overscroll but allow scrollable divs to scroll normally?
- Selecting text on focus using jQuery not working in Safari and Chrome
- Apply CSS to jQuery Dialog Buttons
- Refresh (reload) a page once using jQuery?
- Fire event on enter key press for a textbox
- TypeError: $(…).parents(…).size is not a function
- JQuery Star Rating [closed]
- How can I change text after time using jQuery?
- Rails accepts_nested_attributes_for with f.fields_for and AJAX