Avatar of FairyBusiness
FairyBusinessFlag for United States of America

asked on 

How do I find the id of an article tag in jquery?

Hi, I need to find the id of the article tag but the id is not the same on every page.

example:       <article id="page_1">

So I thought to try this:

var page = $('#content').find('#:article');

but no luck.  Anyone know how to do this?
JavaScript

Avatar of undefined
Last Comment
FairyBusiness
ASKER CERTIFIED SOLUTION
Avatar of Zyloch
Zyloch
Flag of United States of America 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 FairyBusiness
FairyBusiness
Flag of United States of America image

ASKER

is there a way to 'echo' it back so that I can see what's inside of that variable?
Avatar of Zyloch
Zyloch
Flag of United States of America image

It depends on what you want to do with it. If you just want to see what it is saying, you can alert() it. What do you want to do with this ID?
Avatar of FairyBusiness
FairyBusiness
Flag of United States of America image

ASKER

yep the alert worked. Thanks!
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