Hôm nay chúng ta sẽ cùng tìm hiểu về bộ chọn jQuery đối với các phần tử trong biểu mẫu (Form Elements) như
<input>, <textbox>, <textarea>,<select>, <button> v.v.. Cùng xem cú pháp và cách sử dụng, cũng như những ví dụ nhé
Để xem tất cả bộ chọn jQuery Selectors. Các bạn truy cập tại đây nhé
jQuery :input Selector
Syntax
Bộ chọn jQuery :input Selector có cú pháp
$(":input")
<input> của biểu mẫu như <textbox>, <textarea>,<select> (drop-down list), và kể cả là <button>
jQuery :text Selector
Syntax
Bộ chọn jQuery :text Selector có cú pháp
$(":text")
<input> của biểu mẫu có type="text"
jQuery :password Selector
Syntax
Bộ chọn jQuery :password Selector có cú pháp
$(":text")
<input> của biểu mẫu có type="password"
jQuery :radio Selector
Syntax
Bộ chọn jQuery :radio Selector có cú pháp
$(":radio")
<input> của biểu mẫu có type="password"
jQuery :checkbox Selector
Syntax
Bộ chọn jQuery :checkbox Selector có cú pháp
$(":checkbox")
<input> của biểu mẫu có type="checkbox"
jQuery :submit Selector
Syntax
Bộ chọn jQuery :submit Selector có cú pháp
$(":submit")
<button>, và <input> của biểu mẫu có type="submit"
Lưu ý: Nếu một phần tử
<button> không xác định loại type, thì hầu hết mọi trình duyệt đều cho button đó có type="submit"
jQuery :reset Selector
Syntax
Bộ chọn jQuery :reset Selector có cú pháp
$(":reset")
<button>, và <input> của biểu mẫu có type="reset"
jQuery :button Selector
Syntax
Bộ chọn jQuery :button Selector có cú pháp
$(":button")
<button> và <input> của biểu mẫu có type="button"
jQuery :image Selector
Syntax
Bộ chọn jQuery :image Selector có cú pháp
$(":button")
<input> của biểu mẫu có type="image"
Lưu ý: Bộ chọn này sẽ không nhận diện ra đối với thẻ
<img src='link_anh' /> nhé
jQuery :file Selector
Syntax
Bộ chọn jQuery :file Selector có cú pháp
$(":file")
<input> của biểu mẫu có type="file"
jQuery :enabled Selector
Syntax
Bộ chọn jQuery :enabled Selector có cú pháp
$(":enabled")
disabled, tức có nghĩa người dùng có thể thao tác trên phần tử đó.
jQuery :disabled Selector
Syntax
Bộ chọn jQuery :disabled Selector có cú pháp
$(":enabled")
disabled, có nghĩa người dùng không thể thao tác trên phần tử đó.
jQuery :selected Selector
Syntax
Bộ chọn jQuery :selected Selector có cú pháp
$(":selected")
drop-down list tức đã có sẵn thuộc tính selected="true" hoặc selected="selected"
Lưu ý: bộ chọn này sẽ không hoạt động với
checkbox và radio buttons. Để sử dụng với checkbox và radio buttons các bạn dùng bộ chọn jQuery :checked Selector được đề cập ở dưới nhé
jQuery :checked Selector
Syntax
Bộ chọn jQuery :checked Selector có cú pháp
$(":checked")
checkbox và radio buttons, tức đã có sẵn thuộc tính checked="true" hoặc checked="checked"

