Skip to Content

Welcome!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

شما نیاز به ثبت‌نام دارید تا بتوانید با جامعه تعامل داشته باشید.
این سوال علامت‌گذاری شده است

میخوام بدونم که زمانی که یک المنت رو در اسناد میخوام انتخاب کنم چطوری و به چه شکلی میتونم این کار رو با Jquery انجام بدم

آواتار
رها کردن
مولف پاسخ برتر

انتخاب گرهای Jquery

برای نشان دادن انتخاب کننده های مختلف از تستر انتخاب کننده jQuery ما استفاده کنید.

elements elements

انتخاب کننده نمونه انتخاب کردن
* $("*") همه عناصر
#id $("#lastname") عنصر با id = "نام خانوادگی"
.class $(".intro") همه عناصر با class = "مقدمه"
.class,.class $(".intro,.demo") همه عناصر با کلاس "مقدمه" یا "نسخه ی نمایشی"
element $("p") همه عناصر

el1,el2,el3 $("h1,div,p")

عناصر دایو و هدر یک و P
:first $("p:first") اولین عنصر

:last $("p:last") آخرین عنصر

:even $("tr:even") تمامی زوجها
:odd $("tr:odd") تمامی فردها
:first-child $("p:first-child")

همه عناصری که فرزند اول والدین آنها هستند

:first-of-type $("p:first-of-type")

همه عناصری که اولین هستندعنصر والدین آنها

:last-child $("p:last-child") آخرین فرزند تگ P
:last-of-type $("p:last-of-type") آخرین عنصر P
:nth-child(n) $("p:nth-child(2)") دو فرزند اول تگ P
:nth-last-child(n) $("p:nth-last-child(2)") دو فرزند آخر تگ P
:nth-of-type(n) $("p:nth-of-type(2)") دو تگ p اخر از فرزندان پدر که تگ Pهستند
:nth-last-of-type(n) $("p:nth-last-of-type(2)") دو فرزند P آخر از یک والد P
:only-child $("p:only-child") عناصری که تنها فرزند والدین آنها هستند
:only-of-type $("p:only-of-type") عناصری که تنها فرزند ، از نوع آن ، والدین خود هستند
parent > child $("div > p") عناصری p  که فرزند مستقیم دایو هستند
parent descendant $("div p")

همه عناصری که فرزندان یک عنصر هستند

element + next $("div + p")

در عنصری که در کنار هر یک  عناصر است

element ~ siblings $("div ~ p")

همه عناصری که بعد از عنصر

:eq(index) $("ul li:eq(3)") The fourth element in a list (index starts at 0)
:gt(no) $("ul li:gt(3)") List elements with an index greater than 3
:lt(no) $("ul li:lt(3)") List elements with an index less than 3
:not(selector) $("input:not(:empty)") All input elements that are not empty
     
:header $(":header") All header elements

,

...

:animated $(":animated") All animated elements
:focus $(":focus") The element that currently has focus
:contains(text) $(":contains('Hello')") All elements which contains the text "Hello"
:has(selector) $("div:has(p)") All
elements that have a

element

:empty $(":empty") All elements that are empty
:parent $(":parent") All elements that are a parent of another element
:hidden $("p:hidden") All hidden

elements

:visible $("table:visible") All visible tables
:root $(":root") The document's root element
:lang(language) $("p:lang(de)") All

elements with a lang attribute value starting with "de"

     
[attribute] $("[href]") All elements with a href attribute
[attribute=value] $("[href='default.htm']") All elements with a href attribute value equal to "default.htm"
[attribute!=value] $("[href!='default.htm']") All elements with a href attribute value not equal to "default.htm"
[attribute$=value] $("[href$='.jpg']") All elements with a href attribute value ending with ".jpg"
[attribute|=value] $("[title|='Tomorrow']") All elements with a title attribute value equal to 'Tomorrow', or starting with 'Tomorrow' followed by a hyphen
[attribute^=value] $("[title^='Tom']") All elements with a title attribute value starting with "Tom"
[attribute~=value] $("[title~='hello']") آنهایی که عنوانشون شامل سلام میشود
[attribute*=value] $("[title*='hello']") آنهایی که عنوانشون برابر با سلام هست
:input $(":input") تمام ورودی ها
:text $(":text") تمام ورودی هایی که نوع آنها متن هست
:password $(":password") تمام ورودی هایی که نوع آنها رمز هست
:radio $(":radio") تمام ورودی هایی که نوع آنها دکمه رادیو هست
:checkbox $(":checkbox") تمام ورودی هایی که نوع آنها چک باکس هست
:submit $(":submit") تمام ورودی هایی که نوع آن ها ارسال هست
:reset $(":reset") تمام ورودی هایی که نوع تنظیم مجدد هستند
:button $(":button") تمام ورودی هایی که تایپ اونها دکمه هست
:image $(":image") تمام ورودی هایی که تایپ اون ها عکس هست
:file $(":file") تمام ورودی هایی که تایپ اون ها فایل هست
:enabled $(":enabled") تمام المنتهایی که فعال باشند(توی اصلی گفته که ورودی هایی که فعال باشند)
:disabled $(":disabled") تمام المنت هایی که غیرفعال باشند(توی اصلی گفته شده که ورودی هایی که غیرفعال باشند)
:selected $(":selected") تمام ورودی هایی که انتخاب شده باشند
:checked $(":checked") تمامی المنتهایی که چک خورده باشند

آواتار
رها کردن
نوشته های مرتبط پاسخ‌ها نماها فعالیت
2
ژوئن 24
274
1
ژوئن 24
206
1
ژوئن 24
222
1
ژوئن 24
199
1
ژوئن 24
190
logo-samandehi