Friday, 2 February 2018

javascript - How to select all elements with same name inside some specific div using jQuery




We have two divs:
How to select all the input field as an array with name="divText" that are inside "div2".



//Body of div1










//Body of div2









Answer



Use Attribute Equals Selector [name="value"] along with ID Selector (“#id”). There is error in your html the closing quote of div id div1 and div2 is missing as well.



Live Demo



$('#div2 input[name="divText"]')

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...