jQuery DOM


فهرست مطالب

    نمایش فهرست مطالب


ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻞﺑﺎﻘﻣ ﺭﺩ ﯼﺮﺋﻮﮐ ﯽﺟ

.ﺪﺷ ﺩﺎﺠﯾﺍ ﮓﯿﺳﺭ ﻥﺎﺟ ﻂﺳﻮﺗ 2006 ﻝﺎﺳ ﺭﺩ ﯼﺮﺋﻮﮐ ﯽﺟ

.ﺖﺳﺍ ﻩﺩﻮﺑ ﻥﺎﻬﺟ ﺭﺩ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻪﻧﺎﺨﺑﺎﺘﮐ ﻦﯾﺮﺗ ﺏﻮﺒﺤﻣ jQuery ،ﻝﺎﺳ 10 ﺯﺍ ﺶﯿﺑ ﯼﺍﺮﺑ

:ﺩﺮﮐ ﻞﺣ ﺩﺭﺍﺪﻧﺎﺘﺳﺍ ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ ﻂﺧ ﺪﻨﭼ ﺎﺑ ﻥﺍﻮﺗ ﯽﻣ ﺍﺭ ﯼﺮﺋﻮﮐ ﯽﺟ ﯼﺎﻫﺭﺍﺰﺑﺍ ﺯﺍ ﯼﺭﺎﯿﺴﺑ ،(200


HTML ﺮﺻﺎﻨﻋ ﻑﺬﺣ

:HTML ﺮﺼﻨﻋ ﮏﯾ ﻑﺬﺣ

ﯼﺮﺋﻮﮐ ﯽﺟ

$("#id02").remove();

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
</head>
<body>

<h2>Remove an HTML Element</h2>
<p id="id01">Hello World!</p>
<p id="id02">Hello Sweden!</p>

<script>
$(document).ready(function() {
  $("#id02").remove();
});
</script>

</body>
</html>

ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

document.getElementById("id02").remove();

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>

<h2>Remove an HTML Element</h2>
<p id="id01">Hello World!</p>
<p id="id02">Hello Sweden!</p>

<script>
document.getElementById("id02").remove();
</script>

</body>
</html>

ﺪﯿﻨﮐ ﺖﻓﺎﯾﺭﺩ ﺍﺭ ﺪﻟﺍﻭ ﺮﺼﻨﻋ

:ﺪﯿﻧﺍﺩﺮﮔﺮﺑ ﺍﺭ HTML ﺮﺼﻨﻋ ﮏﯾ ﺪﻟﺍﻭ

ﯼﺮﺋﻮﮐ ﯽﺟ

myParent = $("#02").parent().prop("nodeName"); ;

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
</head>
<body>

<h2>Getting Parent HTML Element</h2>
<p id="01">Hello World!</p>
<p id="02">Hello Sweden!</p>

<p id="demo"></p>

<script>
$(document).ready(function() {
  $("#demo").text($("#02").parent().prop("nodeName")); 
});
</script>

</body>
</html>

ﺖﭙﯾﺮﮑﺳﺍ ﺍﻭﺎﺟ

myParent = document.getElementById("02").parentNode.nodeName;

→ ﺪﯿﻨﮐ ﻥﺎﺤﺘﻣﺍ ﺍﺭ ﻥﺁ ﻥﺎﺗﺩﻮﺧ

<!DOCTYPE html>
<html>
<body>

<h2>Get Parent HTML Element</h2>
<p id="01">Hello World!</p>
<p id="02">Hello Sweden!</p>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = document.getElementById("02").parentNode.nodeName;
</script>

</body>
</html>