Last active
August 29, 2015 14:04
-
-
Save leongaban/e9bd67d5d40d4b0792b3 to your computer and use it in GitHub Desktop.
.each to create Objects (jQuery)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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