in my html page there are three form input has been related each other. first input as combobox with option:
if first input fill is "TCA" when user input in second input "01" so in third input automaticly filled by "1-120". if first input fill is "intasept" when user input in second input "01" in third input automaticly fille by "1-32".
on simple logic.
this will continue with interval 120. ex:
if in first input = Intasept (selected option by user).
ex:
help me how to make this function in javascript. this, what i have tried but this not run
var interval, step;
$("#first").change(function (e) {
if (this.option:selected) interval = { // map of input value attributes to interval values
"TCA": 120,
"intasept": 32
}[this.value];
update();
});
$("#secondInput").on("change keyup input paste", function (e) {
step = parseInt(this.value, 10);
update();
});
function update() {
if (isNaN(interval) || isNaN(step)) return;
$("#thirdInput").val(((interval * step + 1)-interval) + "-" + ((interval * step + interval)-interval));
}
http://jsfiddle.net/n8pSt/
Add a list of items to the combo box and display an initial item in the selection field of the combo box. Detect when the user has selected an item from the combo box. Retrieve the selected item from the combo box.
Steps to create ActiveX Control Combo Box in Excel. Follow either of the 2 ways to view “New Name” dialog box –. Go to Formula tab -> click on “Name Manager” -> Click New in the “Name Manager” dialog box. OR. Go to Formula tab -> click “Define Name”. Enter Name, Months.
Instructions. 1 Step 1: Create an instance of the combo box. The example application calls the CreateWindow function to create a child window of the application ... 2 Step 2: Load the combo box with the item list. 3 Step 3: Detect when the user selects an item and retrieve it from the combo box.
Step 1: Create an instance of the combo box. The example application calls the CreateWindow function to create a child window of the application window. The WC_COMBOBOX window style specifies that it is a combo box.
http://jsfiddle.net/QXFKL/5/
if (this.option:selected) interval = { // map of input value attributes to interval values
"TCA": 120,
"intasept": 32
}[this.value];
but the value that you are getting is "Intesept" Casesensitive
also your if didnt work so I've removed it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With