Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.each to create Objects (jQuery)
addedPhones = $('.added_phone');
addedPhones.each( function(i) {
var tag = $(this).children("label").text();
var value = $(this).children("input").val();
phoneObjs = $(this).map(function(i,el) {
var $el = $(el);
return {
label: value,
tag: tag
}
}).get();
params.phones = params.phones.concat(phoneObjs);
});
<div class='removeable'>
<li class='added_phone'>
<label>" +labelText+ "</label>
<span> Phone</span>
<br/>
<input class='new_phone' type='tel' pattern='[0-9]{10}' name='" +nameText+ "' value='' autocomplete='off' maxlength='20' />
<div class='remove_info'></div>
</li>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.