L7 Jquery
L7 Jquery
JavaScript
• JavaScript is a scripting language developed by Netscape to allow
basic dynamic operations to be performed in browsers.
• Originally created to be easily learned by web developers to add basic
interactivity to an HTML page
• JavaScript has since evolved into a tool most developers can't live
without.
• However, because of various cross browser and legacy issues,
• many operations programmers would consider simple in environments such
as app development are comparatively complex.
jQuery
• jQuery offers the JavaScript developer more power and flexibility
while simplifying and reducing the amount of code required.
OR
$(function() {
//code here
});
Common CSS selectors using jQuery
• //select all h1 elements
• $(‘h1’)
• $('[class^="col"]')
• find all elements where the value contains a string, use the *=
operator.
• $('[class*="md"]')
Selecting elements based on position
• Parent/Child
• <nav>
• <a href="#">(First) This will be selected</a>
• <div>
• <a href="#">(Second) This will **not** be selected</a>
• </div>
• </nav>
Selecting elements based on position
• Descendants
• // Selects all a elements that are descendants nav element
• // The elements can appear anywhere inside of the element listed first
• $('nav a')
• <nav>
• <a href="#">(First) This will be selected</a>
• <div>
• <a href="#">(Second) This will be selected</a>
• </div>
• </nav>