Get input value with jQuery

0

I'mtryingtogetthevalueofhowever,itreturnsmeonlytheinput.pgtasitcanbeseenintheimageabove,alreadytriedwith.valueand.val(),howeveritstilldoesnotwork,followthecodeimagebelow:

Ineedittoreturnthevaluethatisinthefield,insteadofitreturningthevaluetheuserwrote,itreturnsmetheDOMelement,forexample:Ityped,"Male", "Female" in each of the fields that contains the "pgt" class, I want these two values to appear in the options array (which is present in the chrome console image), but instead of appearing "Male", "Female", it appears "input.pgt", "input.pgt"

    
asked by anonymous 20.11.2017 / 18:57

1 answer

-1

I was able to solve the problem, the problem was that when I used .get() at the end of $.each , it took the DOM element instead of the value, so I decided to use .map() instead of .each() , so it maps and returns the value. Below is the corrected code.

    
20.11.2017 / 19:38