Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

JQuery: Select class within (this)

Featured Replies

Good Morning everyone,

 

The problem I am having is with jQuery selectors. What I'm trying to do it's very complex I don't think but I am new to using jQuery so I've probably made some fundamental mistake.

So basically what I am trying to achive is when the class .titleanddescription is clicked on the first time it changes the height of the .more class within .titleanddescription. And then changes it back on the Second click.

 

So selecting a class within (this) is what I guess I am trying to achieve. I'm not using slidetoggle because there are other effects I want to add.

 

Thankyou for any advice you can offer.

 

jQuery:

function serviceslide() {

		$(".titleanddescription").toggle(
							function () {
									alert ("First");
									$(this).(".more").css("height":"750px");								
								     }, 

							 function () {  
									alert ("Second");
									$(this).(".more").css("height":"0px");	
								       }

						     );

		     }

HTML:

		<div class="serblock">
		<div class="titleanddescription">
			<h2 class="service">Title</h2>
			<p>Description</p>
			<p class="more">More Details</p>
		</div>
              </div>

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.