Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Google Docs
Each Attachment size should not exceed 1.0 MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Move this topic
Forum :
Getting Started
Using jQuery
Using jQuery Plugins
Using jQuery UI
Developing jQuery Core
Developing jQuery Plugins
Developing jQuery UI
QUnit and Testing
About the jQuery Forum
jQuery Conferences
jQuery Mobile
Developing jQuery Mobile
Sub forum :
Move this topic
Cancel
Developing jQuery Core
justinbme..
Objects with toString work in html, append, etc
In-progress
Maybe later
Under review
In-progress
Implemented
Will not implement
in
Developing jQuery Core
•
11 years ago
It might be nice to do something like:
Dog = function(){}
Dog.prototype.toString = function(){ return "woof"}
dog = new Dog()
$("#foo").html(dog)
This can be solved super easy, I just feel like this would already work if it was meant to.
2
Reply
Replies(3)
rwaldron
Re: Objects with toString work in html, append, etc
11 years ago
To clarify....
You're intention is to have basically this:
$('#foo').html(dog)
behave like:
$('#foo').html(dog.toString())
and print out "woof" inside of $('#foo')
?
Leave a comment on rwaldron's reply
justinbme..
Re: Objects with toString work in html, append, etc
11 years ago
'woof' instead of what happens now ... jQuery breaks (1.4.1).
jeresig
Re: Re: Objects with toString work in html, append, etc
11 years ago
Seems reasonable, I can check in to this.
Leave a comment on justinbmeyer's reply
integsrti..
Re: Objects with toString work in html, append, etc
10 years ago
Any update on this? Don't think 1.5 is doing it. Seems like it would just be another else case inside .html()
jQuery already natively invokes the parameter of .html() and .text() if it sees that it is a method.
Can we add another else case where if it is an object and the object provides a toString, then it invokes that?
Leave a comment on integsrtite's reply
Change topic type
Topic Type :
Discussions
Questions
Ideas
Problems
No of days :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Change topic type
Cancel
Link this topic
Provide the permalink of a topic that is related to this topic
Permalink
Save
Close
Reply to justinbmeyer's idea
Top
Reply
{"z165885":[14737000000743167,14737000000743179],"z2566198":[14737000000743341],"z2949817":[14737000000743177],"z5587408":[14737000002036666]}
Statistics
3
Replies
11872
Views
1
Followers
Tags
Cancel
manipulators
Actions
Permalink