send a video file once and multiple users stream it? Relative pronoun -- Which word is the antecedent? Making statements based on opinion; back them up with references or personal experience. The second line displays an alert detailing which element of the array was clicked. rev2023.7.27.43548. Introduction to jQuery get parent JQuery provides different types of functionality and methods to the user; in which that jQuery get parent is one of the methods provided by jQuery. Like if I click on child element of second parent div, I'd like to get a 2. Suppose we have an array of subjects as "subject = [ "English", "Hindi", "Science" ]", now we need to get the index of "Science" subject. I looked for a solution to this problem, and came across the present page. Connect and share knowledge within a single location that is structured and easy to search. There are two list elements that contain the selected em element. How to draw a specific color with gpu shader. How to select direct parent element of an element in jQuery ? The JQuery array indexOf () function accepts two parameters, the first parameter is the element that is to search in the given array, and the second parameter is the index value from where the search started. Child Selector ("parent > child") - jQuery API Documentation Are self-signed SSL certificates still allowed in 2023 for an intranet server running IIS? Thanks for contributing an answer to Stack Overflow! :nth-of-last-type() version added: 1.0 .parents ( [selector ] ) selector Type: Selector If you have a collection input elements with the same name (like