Notes for You:: JavaScript getElementsByTagName() - JavaScript Tutorial 105
JavaScript document.getElementsByTagName("tagName");
used to access HTML elements by their tag name.
elementRef.innerHTML = "value";
used to change content of referenced HTML element.
elementRef.style.propertyName = "value";
used to apply css styles to referenced HTML element.
Example code:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Accessing HTML Elements</title>
</head>
<body>
<h1>Heading Text</h1>
<p>Paragraph Text</p>
<h1>Heading Text</h1>
<p>Paragraph Text</p>
<h1>Heading Text</h1>
<p>Paragraph Text</p>
<h1>Heading Text</h1>
<p>Paragraph Text</p>
<script type="text/javascript">
var headings = document.getElementsByTagName("h1");
for(var i=0; i<headings.length; i++)
{
headings[i].style.backgroundColor = "gray";
headings[i].style.color = "white";
}
var paragraphs = document.getElementsByTagName("p");
for(var i=0; i<paragraphs.length; i++)
{
paragraphs[i].style.backgroundColor = "orange";
paragraphs[i].style.color = "black";
}
</script>
</body>
</html>
Note:
replace < with less-than symbol.
replace > with greater-than symbol.
=========================================
Follow the link for next video:
How to Handle Events in JavaScript - JavaScript Tutorial 106
• How to handle JavaScript Events - Jav...
Follow the link for previous video:
JavaScript document.getElementsByClassName() - JavaScript Tutorial 104
• JavaScript getElementsByClassName() -...
=========================================
JavaScript Tutorials Playlist:-
• JavaScript Tutorials
=========================================
Watch My Other Useful Tutorials:-
jQuery Tutorials Playlist:-
• jQuery Tutorials
jQuery UI Tutorials Playlist:-
• jQuery UI Tutorials
Bootstrap Tutorials Playlist:-
• Bootstrap4 Tutorials
=========================================
HI, I am Manjunath Chidre and I'm an Indian born. I make video tutorials on Computer Science, Information Technology, Animation, VFX, Multimedia, & Gaming courses. Essentially, I set my goal to help students around the world; to learn at free of cost; through my educational YouTube channel Chidre'sTechTutorials.
=========================================
Every video on my channel is made with Love and Hard work, So don't forget to Like, Comment & Share.
Please do Subscribe, Hit the bell icon & Enjoy Learning. It's FREE.
=========================================
Subscribe to our YouTube channel:-
/ chidrestechtutorials
Join as member of our YouTube channel:-
https://www.youtube.com/chidrestechtu...
Become our Patron:-
/ chidrestechtutorials
Visit our Website:-
https://www.chidrestechtutorials.com
Download our Notes from Instamojo:-
https://chidrestechtutorials.myinstam...
Buy our Products on Spring:-
https://chidres-tech-tutorials.creato...
=========================================
Follow us:-
Google My Business:-
https://chidrestechtutorials.business...
Google Blog:-
http://manjunathchidre.blogspot.com
LinkedIn:-
/ chidrestechtutorials
Facebook:-
/ chidrestechtutorials
Twitter:-
/ manjunathchidre
Tumblr:-
/ chidrestechtutorials
Pinterest:-
/ chidrestechtutorials
=========================================
Despite my inconsistent uploads; Thanks for being amazing learners and still sticking with me on YouTube.
=========================================
Hash Tags:-
#ChidresTechTutorials #JavaScript #JavaScriptTutorial
На этой странице сайта вы можете посмотреть видео онлайн JavaScript getElementsByTagName() - JavaScript Tutorial 105 длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь ChidresTechTutorials 27 Апрель 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 528 раз и оно понравилось 14 зрителям. Приятного просмотра!