last day (14 days later) » 

8:14 AM
2
A: JQuery:Trying to append the options to select tag

mohamedriasYou're trying to append the string directly. But you must append the DOM element. var option = '<option value="'+value.id+'">'+value.text+'</option>'; $('#graph_name').append(option); It must be var option = $('<option value="'+value.id+'">'+value.text+'</option>'); $('#graph_name').a...

 
Actually the problem is it is appending but not showing to dropdown. Instead when i saw it in the firebug, it is showing me appended but the whole div i have seen is in disabled format. what is it i am not getting
 
Can you create a jsfiddle to look at?
 
i will add the screenshot here. jsfiddle will take time i have chosen plugin that i am using to modernize the dropdown
check the edited post
 
for both of them display: none property is set in css. It's very specific to chosen plugin. Please setup a jsfiddle to check.
 
ok i will try havent used jsfiddle before....
i tried at my level you can correct it link:jsfiddle.net/sagar_barwade/jyn1jr05
 
8:14 AM
Great! Looking at it. Please share some sample data for data.graphs
 
what the fish......when i remove the chosen class for second dropdown then it is showing me the output in the dropdown the problem is with chosen class for second dropdown....
 
Yes, chosen hides the default dropdown and shows the custom dropdown. It styles te dropdown using CSS
 
hi when i removed the chosen-select from second select tag it bave me what i want
what should i do to resolve it.
 
no don't do that..
since we're dynamically populating the options
chosen is not aware of it.. So after you've populated the options. outisde the loop trigger the chosen() function again
$(".chosen-select").chosen({width: "95%"});
This will fix your issue :)
 
wait i'll try
hi i am initializing but couldnt find the output can you plese help me calling it in jsfiddle i will add the initializing js code
 
8:27 AM
Okay, sure just provide the data.grpah sample output
I'll update the fiddle
 
sample data:
{"status":"OK","response":200,"graphs":[[{"id":"B","text":"Bar Chart"},{"id":"D","text":"Doughnut Chart"
},{"id":"P","text":"Pie Chart"}]]}
thank you so much you are giving your time here.....
the last one is updated
just paste your link of jsfiddle after update
 
8:43 AM
We're missing: $('#graph_name').trigger("chosen:updated");
:D
Hope it worked for you too. I've updated the answer as well. Am going out now, ciao
 
9:16 AM
ohhh! Thank yopu so much its working now.....Just edit your answer below the post i will accept it! thanks for help
 
 
1 hour later…
10:29 AM
Hey! i have one more request can you tell me how can i remove the data on second iteration? I mean once i show the graph, user will go to select second value & graph associated with that at that time my old options need to be removed & new must be inserted where to do that & possible way??
 

last day (14 days later) »