If you use contents()
method it will also return text nodes. Since jQuery doesn’t have text node methods, convert last node to a DOM node
$('label[for="user_name"]').contents().last()[0].textContent="Title";
More Related Contents:
- javascript change element from another page
- This doesn’t seem right? Javascript isn’t working
- Pure JavaScript equivalent of jQuery’s $.ready() – how to call a function when the page/DOM is ready for it [duplicate]
- Refresh/reload the content in Div using jquery/ajax
- How to delete a localStorage item when the browser window/tab is closed?
- Animate element to auto height with jQuery
- Get list of data-* attributes using javascript / jQuery
- Jquery Mobile – $.mobile.changepage not loading external .JS files
- Create table with jQuery – append
- Disable dragging an image from an HTML page
- When using jQuery on(), why use (document) vs. the element itself?
- Detect if browser is running on an Android or iOS device
- Adding rows dynamically with jQuery
- How to make supported on all browsers? Any alternatives?
- Count textarea characters
- How can I change the font (family) for the labels in Chart.JS?
- Preview images before upload
- jQuery equivalent of getting the context of a Canvas
- Running Javascript in new window.open
- Unusual shape of a textarea?
- How to display Image dynamically on UI?
- Fade background image in and out with jQuery?
- Trying to load local JSON file to show data in a html page using JQuery
- How to do something before on submit?
- Disable zoom on input focus in Android webpage
- Include html in another html file [duplicate]
- Detect if dropdown navigation would go off screen and reposition it
- Iframe inherit from parent
- canvas- Cropping images in different shapes
- trigger file upload dialog using javascript/jquery