Side navigation
#8929 closed feature (wontfix)
Opened April 20, 2011 11:11PM UTC
Closed April 21, 2011 12:05AM UTC
Provide auto-trim option for .text()
| Reported by: | AlistairB | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | manipulation | Version: | 1.5.2 |
| Keywords: | needsreview | Cc: | |
| Blocked by: | Blocking: |
Description
I am constantly writing code like this:
var myId = $.trim($(".some-element").text());
It would be nice to have a leaner way to do this. eg.
var myId = $(".some-element").text(true);
var myId = $(".some-element").textTrim(); //there isprobably a better name for this
Attachments (0)
Change History (3)
Changed April 20, 2011 11:24PM UTC by comment:1
| component: | unfiled → manipulation |
|---|---|
| keywords: | → needsreview |
| priority: | undecided → low |
| status: | new → open |
| type: | enhancement → feature |
Changed April 20, 2011 11:31PM UTC by comment:2
If you do this a lot, write a utility function.
$.fn.textTrim = function() {
return $.trim(this.text());
}
I don't think we should add this to core.
Changed April 21, 2011 12:05AM UTC by comment:3
| resolution: | → wontfix |
|---|---|
| status: | open → closed |
Second ajpiano