English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The #ID The selector is based on the element's id attribute value.
It is declared with a hash(#) before a string of one or more characters.
The ID of the element should be unique in the page, so the ID selector is used to select a unique element.
Note:Do not use numbers as the beginning of the id attribute, as it may cause exceptions in some browsers..
$("#id")
Select the element with ID "demo":
$(document).ready(function(){ $("#demo").css("background-color", "yellow"); });Test See‹/›
Parameter | Description |
---|---|
id | Specify the ID of the element to be selected |