frontend/static/js/script.js
//render the dropdown messageand handle user selection
render the dropdown messageand handle user selection
render the dropdown messageand handle user selection
function renderDropDwon(data) {
	var options = "";
	for (i = 0; i < data.length; i++) {
		options += '<option value="' + data[i].value + '">' + data[i].label + '</option>'
	}
	var select = '<div class="dropDownMsg"><select class="browser-default dropDownSelect"> <option value="" disabled selected>Choose your option</option>' + options + '</select></div>'
	$(".chats").append(select);
	$("select").change(function () {
		var value = ""
		var label = ""
		$("select option:selected").each(function () {
			label += $(this).text();
			value += $(this).val();
		});
		setUserResponse(label);
		send(value);
		$(".dropDownMsg").remove();
	});
}
function renderDropDwon ( data ) { var options = "" ; for ( i = 0 ; i < data . length ; i ++ ) { options += '<option value="' + data [ i ] . value + '">' + data [ i ] . label + '</option>' } var select = '<div class="dropDownMsg"><select class="browser-default dropDownSelect"> <option value="" disabled selected>Choose your option</option>' + options + '</select></div>' $ ( ".chats" ) . append ( select ) ; $ ( "select" ) . change ( function ( ) { var value = "" var label = "" $ ( "select option:selected" ) . each ( function ( ) { label += $ ( this ) . text ( ) ; value += $ ( this ) . val ( ) ; } ) ; setUserResponse ( label ) ; send ( value ) ; $ ( ".dropDownMsg" ) . remove ( ) ; } ) ; }
render the dropdown messageand handle user selection
render the dropdown messageand handle user selection
//add event handler if user selects a option.