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
Using jQuery
goody44
Remove object attribute
in
Using jQuery
•
12 years ago
Hi guys/girls,
I have an object created by:
var
obj
= {};
obj
.
item1
= {};
obj
.
item2
= {};
obj
.
item3
= {};
obj
.
item4
= {};
I am wanting to remove one of the attributes. So I call $(obj).removeAttr('item1')
This empties the attribute but the attribute still exists.
Any pointers would be great!
Here's the print out from chrome's js console
obj
Object
item1
:
Object
item2
:
Object
item3
:
Object
item4
:
Object
__proto__
:
Object
$(obj).removeAttr('item1')
[
Object
item1
:
""
item2
:
Object
item3
:
Object
item4
:
Object
__proto__
:
Object
]
1
Replies(3)
kbwood.au
Re: Remove object attribute
12 years ago
There's no need to use jQuery for this as it's just a plain object. You could set the item to null:
obj.item1 = null;
or remove it entirely with:
remove obj.item1;
Leave a comment on kbwood.au's reply
goody44
Re: Remove object attribute
12 years ago
Is there a way to remove the reference because if I do a loop over the object the item1 attribute still shows up
Leave a comment on goody44's reply
goody44
Re: Remove object attribute
12 years ago
turns out I was over complicating it. I just call
delete obj.item1
and its gone.
Thanks for pointing me in the right direction
Leave a comment on goody44'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 goody44's question
Top
Reply
{"z4296404":[14737000002104423,14737000002104436,14737000002104438],"z2953500":[14737000002102944]}
Statistics
3
Replies
13725
Views
0
Followers
Tags
Cancel
removeattr
object
remove
attribute
Actions
Permalink