Append option values to a hidden field?

With the push of a button, I'm iterating through a list of options in a select. I wish to append all of these option (values of the options) to a hidden fields, separated by a pipe |. So far I've come up with this, however, It just puts the last value of the option in the select in the hidden field?

//Select all cities
$jq("input#checkcities").click(function () {

    $jq(".select-cities > option").each(function () {
        var zipCodeValue = $jq(this).val();

        $jq(".select-cities option").attr("selected", "selected");
        $jq(".select-cities option").appendTo(".chosen-cities");

        //Put value of cities in hidden field.



Try like this

$jq('.hiddenFieldChosenCities').val($jq('.hiddenFieldChosenCities').val() + '|' + zipCodeValue);

You can use map method:

var zipCodeValues = $jq(".select-cities > option").map(function () {
                          return this.value;


Need Your Help

WLST - force stop application

java python weblogic weblogic-10.x wlst

I am currently working with weblogic and the thing is that I deploy several applications on my weblogic server. Sadly, when one of this application fail to deploy for X/Y reason, I just want to force

Email HTML: tel:// <a> color

html-email email-client

I'm doing a newsletter design and there's a text with a phone number. In many email clients it looks as supposed to but in Gmail it turns the numbers string into a tel:// link to call with gmail's ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.