Best and easy solution to remove all text elements from certain div is
$("#firstDiv").contents().filter(function(){
return (this.nodeType == 3);
}).remove();
Related Contents:
- jQuery callback on image load (even when the image is cached)
- Firing events on CSS class changes in jQuery
- How to get URL parameter using jQuery or plain JavaScript?
- jqGrid: Disable form fields when editing
- What is the easiest way to disable/enable buttons and links (jQuery + Bootstrap)
- jQuery if checkbox is checked
- AJAX in Chrome sending OPTIONS instead of GET/POST/PUT/DELETE?
- jquery IDs with spaces
- Animate element transform rotate
- HTML5 Canvas 100% Width Height of Viewport?
- How can I bind all events on a DOM element?
- How to enable CORS in flask
- How to get multiple select box values using jQuery?
- jQuery Validation Plugin – adding rules that apply to multiple fields
- datatable jquery – table header width not aligned with body width
- How to access JSON Object name/value?
- jQuery Datepicker with text input that doesn’t allow user input
- jQuery – add additional parameters on submit (NOT ajax)
- Replace text in HTML page with jQuery
- Pass jquery variables between iframe and parent
- jQuery – Illegal invocation
- jQuery – use wrap() to wrap multiple elements?
- event.originalEvent jQuery
- jQuery toggle CSS?
- Error: Uncaught SyntaxError: Unexpected token
- jQuery : remove element except inside element
- Change Twitter Bootstrap Tooltip content on click
- jquery Setting cursor position in contenteditable div
- Dynamically adding collapsible elements
- Multiple Parameters for jQuery selector?
- How to load a Google Maps map inside of a hidden element
- Append text to input field
- How can we specify rules for jQuery validation plugin by class?
- Does AJAX loaded content get a “document.ready”?
- Twitter Bootstrap Collapse plugin Direction—Horizontal instead of Vertical
- What is the best way of showing progress on an Ajax call?
- jquery fill dropdown with json data
- Is it possible to create a namespace in jQuery?
- Fancybox stuck loading iframe in IE
- Count elements with jQuery
- How does GitHub change the URL without reloading a page?
- jquery load() strips script tags – workaround?
- Target elements by class prefix
- Limit number of characters in input field
- jQuery: dealing with a space in the id attribute
- How do I explicitly execute default action from jQuery event
- How to return an object from a Spring MVC controller in response to AJAX request?
- How can I remove the search bar and footer added by the jQuery DataTables plugin?
- How do I use requireJS and jQuery together?
- Autocomplete issue into bootstrap modal