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 Plugins
gcskye
Jquery addRemove Class - If statement
in
Using jQuery Plugins
•
10 years ago
I need when I click Toggle for the jQuery to remove .hidesome and change it to .show and vise versa.
Can not get this...it's been 4 hours of searching.
<a href="#" class="button">Toggle</a>
<div class="signatureContain">
<div class="signature hidesome">
When the button above is pressed you should see the rest<br />
"the rest"
</div>
</div>
<a href="#" class="button">Toggle</a>
<div class="signatureContain">
<div class="signature hidesome">
When the button above is pressed you should see the rest<br />
"the rest"
</div>
</div>
('.signatureContain').live('click',function(){
if ($(this).hasClass('hidesome'))
{
$(this).removeClass('hidesome');
$(this).addClass('show');
} else
{
$(this).removeClass('show')
$(this).addClass('hidesome');
}
});
.hidesome{ height:20px;overflow:hidden}
.show{ height:auto }
http://jsfiddle.net/w3Hg3/
Solved:
http://stackoverflow.com/questions/14470844/jquery-addremove-class-if-statement
1
Replies(2)
krishna595
Re: Jquery addRemove Class - If statement
10 years ago
Hi gcskye,
Try this instead or ur jquery code,
$(document).ready(function(){
$('.button').click(function(){
var idx = $(".button").index(this);
$('.hidesome').eq(idx).toggleClass('show')
});
})
Leave a comment on krishna595's reply
kbwood.au
Re: Jquery addRemove Class - If statement
10 years ago
Try this:
$(function() {
$(document).on('click', 'a.button', function() {
$(this).next('div.signatureContain').
find('div.signature').toggleClass('show hidesome');
return false;
});
});
Leave a comment on kbwood.au'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 gcskye's question
Top
Reply
{"z8217194":[14737000003915508],"z2953500":[14737000003915918],"z4953024":[14737000003916024]}
Statistics
2
Replies
2007
Views
1
Followers
Tags
Cancel
addclass
removeclass
if statement
Actions
Permalink