Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery select first matching element

// Selects the first matched DOM element.
let myElem = jQuery('.elemClass:first');

/*
	Some notes:
    
    - Because :first is a jQuery extension and not part 
    of the CSS specification, queries using :first cannot 
    take advantage of the performance boost provided by the 
    native DOM querySelectorAll() method. To achieve the 
    best performance when using :first to select elements, 
    first select the elements using a pure CSS selector, 
    then use .filter(":first").
    
	- Selected elements are in the order of their appearance 
    in the document.
*/
Comment

PREVIOUS NEXT
Code Example
Javascript :: Pass object to query on Router.push NextJs 
Javascript :: javascript new date from string dd/mm/yyyy 
Javascript :: get server by id discord.js 
Javascript :: insert property multiple documents mongodb 
Javascript :: javascript .foreach 
Javascript :: two array in one js 
Javascript :: select elements of an array starting by a certain letter javascript 
Javascript :: nodemon watch extensions 
Javascript :: Mars Exploration problem in js 
Javascript :: on click copy text 
Javascript :: string to date js 
Javascript :: body-parser deprecated 
Javascript :: difference between library and framework in javascript 
Javascript :: js copy array into another 
Javascript :: javascript date object format yyyy mm dd 
Javascript :: vue mapgetters with parameter 
Javascript :: js stairs algorithm 
Javascript :: usereducer react js 
Javascript :: how to push items in array in javascript 
Javascript :: javascript dump strack trace 
Javascript :: jquery has parent with class 
Javascript :: deduplicate array javascript 
Javascript :: hexstring to rgb array js 
Javascript :: angular print json 
Javascript :: timeout 
Javascript :: javascript whitespace strip 
Javascript :: how can i convert object to an array javascript 
Javascript :: javascript append array to array 
Javascript :: moment to javascript date 
Javascript :: javascript get black or white text base on color 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =