DevBox - ComboBox Plugin

Load your combos in an easy way and do not let your users waiting!

Example 1: Array

							
    $("#comboExample1").comboBox({
	    itens: [
		    { id: 1, name: "John", age: 20 },
		    { id: 2, name: "Steve", age: 25 },
		    { id: 3, name: "Bill", age: 19 },
		    { id: 4, name: "Brandon", age: 31 },
		    { id: 5, name: "Ryan", age: 27 }
	    ],
	    value: "id",
	    text: "{id} - {name} ({age})"
    });
						    
					    

Example 2: Ajax

						    
    $("#comboExample2").comboBox({
	    url: "https://api.github.com/users/" + $("#githubAccount").val() + "/repos",
	    value: "id",
	    text: "{name} ({description})",
		defaultText: false
    });
					        
				        

Example 3: Events

						    
    $("#comboExample3").comboBox({
		url: "https://api.github.com/users/" + $("#githubAccountEvent").val() + "/repos",
		params: { 
			nameParam1: true,
			nameParam2: "potato",
			nameParam3: 42
		},
		value: "id",
		text: "name",
		defaultText: "Select your repository!",
		onStart: function () { 
			$("#githubAccountInfo").val("Starting..."); 
		},
		onLoad: function (data) { 
			alert("Combo Loaded!");	
			console.log("Only repositories with bugs...");
			console.log(data);
		},
		onComplete: function () { 
			$("#githubAccountInfo").val("Finished!");
			setTimeout(function () {
				$("#githubAccountInfo").val("");
			}, 1000);
		},
		onError: function (xhr) { 
			alert("Some shit happened!"); 
			console.log(xhr.responseText);
		}
	});