Avatar of badwolfff
badwolfffFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

Why is this jQuery not working?

jQueryJavaScriptHTML

Avatar of undefined
Last Comment
badwolfff
Avatar of hielo
hielo
Flag of Wallis and Futuna image

The general syntax is: $('.selector', 'context'); So, target '.quantity-adder' (the selector) within the closest('.qty') (the context):
$('.quantity-adder', $('button:contains("Avvisami quando questo articolo diventa disponibile")').closest('.qty') ) .hide();
Avatar of badwolfff
badwolfff
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Excellent! It works... however since I wasn't expecting the code to be in this format (selector/context), I would like to ask you how I could convert this string in the jquery each format as I have several similar cases on the same page.
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of badwolfff
badwolfff
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

:)
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo