Link to home
Create AccountLog in
Avatar of ram0nm
ram0nmFlag for United States of America

asked on

How do I select the h3 tag inside a div? (prototype.js)

<div id="indivpost1">
	<img src="th-1.jpg" />

Open in new window

Shouldn't this work?
$$('#indivpost1 h3')

Open in new window

Please tell me what I'm doing wrong.
Avatar of CCSOFlag
Flag of United States of America image

your tag says javascript, but it looks like you are looking for JQuery maybe?

I don't use JQuery, but in Javascript it is:

var myDiv = document.getElementById('indivpost1');
var myTag = myDiv.getElementsByTagName('h3');

This will get you all h3 tags within that element.
Avatar of ram0nm


Thanks for your help but I'm using Prototype not jQuery.
>>$$('#indivpost1 h3')
This should return an array with one element (with your example)
try breaking it down
$$('#indivpost1') .find('h3');
Avatar of leakim971
Flag of Guadeloupe image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account