jQuery - JackieWSC/Onepiece GitHub Wiki
jQuery
- jQuery is a JavaScript library
- jQuery is a simplifies JavaScript programming
Base Syntax
- $(selector).action()
- A $ sign to define/access jQuery
- A (selector) to "query" HTML elements
- A jQuery action() to be performed on the element
- Example
$(this).hide() // hides the current element
$("p").hide() // hides all <p> elements
$(".test").hide() // hides all elements with class="test"
$("#test").hide() // hides the elements with id="test"
-
id vs class vs name
- id should be unique in the page
- id and class are primarily used for css and javascript
- name do not have to be unique, and can be used to group elements together such as radio buttons and checkboxes
- name attribute is used for posting
- name mainly use in form
- reference
-
Reference