<div class="my_element">
<input name="one">
<input name="two">
</div>
<input name="three">
function getNames(selector) {
var names = [];
$(selector).find('[name]').each(function() {
names.push(this.name);
});
return names;
}
var names = getNames('.my_element');
console.log(names); // ['one', 'two']