Hiptop
Hiptop

Reputation: 79

How to get multiple selected from input value?

I am trying to show multiple selected option of a person from selected value. Here is an example but not working.

I want to do like this dynamically .

Upvotes: 0

Views: 509

Answers (4)

Jon..
Jon..

Reputation: 440

HTML

1. General Events.

<input type="checkbox" name="GE[]" value="Brainometer>
<input type="checkbox" name="GE[]" value="Hot Seat">
<input type="checkbox" name="GE[]" value="Mind Drill> 
<input type="checkbox" name="GE[]" value="Techno Art>
<input type="checkbox" name="GE[]" value="Photography">

If U Want to get multiple selected option of a person from selected value Using PHP: use implode... multiple value can be store in $ge depends on what the user select...

PHP

if(isset($_POST['GE'])){
      $ge = implode(", ",$_POST['GE']);
}else{
      $ge = "";
}</p>

Upvotes: 0

vinayakj
vinayakj

Reputation: 5681

$('.value').val('demo 1,demo 2');

$('.chosen-select').val($('.value').val().split(',')) // set value, accepts array

$('.chosen-select').chosen();

$('.chosen-select').on('change', function() {

    values = $('.chosen-select').val();

$('.value').val(values);

}) ;

Upvotes: 0

ebilgin
ebilgin

Reputation: 1252

Basicly you need a trigger("chosen:updated")

I'd updated your fiddle, you can find here http://jsfiddle.net/ebilgin/hdz8f1b6/2/. I hope it works for you.

Upvotes: 2

cssyphus
cssyphus

Reputation: 40038

Add this to css (for example):

.result-selected{color:white !important; background:blue !important;}

Upvotes: 0

Related Questions