بسم الله الرحمن الرحیم
ایجاد جدول مندرجات طبق هدها در یک فایل
فهرست علوم
علوم کامپیوتر
نکات جاوا اسکریپت-java script
پنجره مودال در جاوا اسکریت
مخفی و آشکار کردن با جاوااسکریپت
Your page should be structured something like this:
Table of Contents
Fruits
Red Fruits
Apple
Raspberry
Orange Fruits
Orange
Tangerine
Vegetables
Vegetables Which Are Actually Fruits
Tomato
Eggplant
hhhhhh
yyyyyy
The Document Object
The querySelectorAll() Method
Change the background color of all elements with class="example":
A div with class="example"
A div with class="example"
This is a p element with class="example".
This is a span element with class="example" inside another p element.
Click me!
Red or green?
Your page should be structured something like this:
Table of Contents
Frkkkkkkkkkkkkkkkkkkkkuits
Red Fruits
Apple
Raskkkkkkkkkkkkkkkkkkkkkpberry
Orange Fruits
Orange
Tangerine
Vegetables
Vegetables Which Are Actually Fruits
Tomato
Eggplant
LCM vs. LLM
hhhhhh
yyyyyy
h2,h1,h3 {color:red}
hhhhhh
yyyyyy
Your page should be structured something like this:
Table of Contents
Fruits
Red Fruits
Apple
Raspberry
Orange Fruits
Orange
Tangerine
Vegetables
Vegetables Which Are Actually Fruits
Tomato
Eggplant
LCM vs. LLM
{ }
Your page should be structured something like this:
Table of Contents
Frkkkkkkkkkkkkkkkkkkkkuits
Red Fruits
Apple
Raskkkkkkkkkkkkkkkkkkkkkpberry
Orange Fruits
Orange
Tangerine
Vegetables
Vegetables Which Are Actually Fruits
Tomato
Eggplant
LCM vs. LLM
First Heading
This is paragrah 1
Second Section
This is some words
And Finally
Some more verbiage
Table of contents will generate below:
Content starts below
h1 heading
h2 heading
h2 heading
h3 heading
h3 heading
h2 heading
h4 heading
h2 heading
h1 heading
h2 heading
h3 heading
h4 heading
h5 heading
h6 heading
h5 heading
h4 heading
h3 heading
h2 heading
h1 heading
table_of_content();
function table_of_content(){
var toc = $('.js_table_of_content h1 , .js_table_of_content h2 ,.js_table_of_content h3 , .js_table_of_content h4');
var count = 0
for (let i = 0; i < toc.length; i++) {
count ++ ;
toc[i].setAttribute("id", "toc_"+count);
var tag_element = toc[i].innerText;
$('.js_toc_content_lists').append(`
${tag_element}
`)
}
}
Title 1
Some content...
Title 2
Some more content...
Title 3
Even more content...
متن اصیل