Three Select Boxes Interacting To Yield One Result - Html, Javascript Or Jquery October 21, 2023 Post a Comment I have three select boxes: Select Productstring1<Solution 1: jsFiddle Demo$(function() { var downloadButton = $( selector-for-your-button ); $(downloadButton).click(function() { download_file( $('#one').val(), $('#two').val(), $('#three').val()); }); }); functiondownload_file(product_id, version_id, arch_id) { // if any of them is default, cancel (use or ||)if (product_id == 'default' || version_id == 'default' || arch_id == 'default') { alert("choose stuff!"); return; } elseif (product_id != 'default') { //window.location = 'mysite.com/download/Install_' +// product_id + '_' + version_id + '_' + arch_id + '.exe';console.log(product_id + '_' + version_id + '_' + arch_id + '.exe'); } } CopySolution 2: You can do something like this using jQuery's .map() function// check if all three select has a value selected besides default - return false if any are defaultif ($('select').filter(function() { returnthis.value == 'default'; }).length > 0) { returnfalse; } // using jQuery's map function - get the values - turn into array - join with '_'var newString = $('select').map(function(i, v) { return v.value; }).get().join('_'); console.log(newString); Copyhttp://jsfiddle.net/4PCfE/Solution 3: Give your <select> boxes a class:<select id="one"class="installer-option"> ... CopyNow, you can use map() to extract the selected options into an array:var options = $('.select').map(function() { return $(this).val(); }); CopyYou can test to see if any default options have been chosen using inArray:if ($.inArray('default', options) != -1) { // There's a default option } CopyFrom there, you can join the strings together into your final URL:var file = options.join('_') + '.exe'; CopyDemo: http://jsfiddle.net/A2q47/3/Solution 4: var product_id=document.getElementById("one").value; var version_id=document.getElementById("two").value; var arch_id=document.getElementById("three").value; Copysomething like this should work http://jsfiddle.net/9a8YH/4/ Share Post a Comment for "Three Select Boxes Interacting To Yield One Result - Html, Javascript Or Jquery" Top Question How To Validate Form Fields And Post The Form Data To Server Using Jquery And Ajax? I am trying to validate form fields like, Name (must not be… Replace Url From Youtube To Embed Code - Error: Permission Denied To Access Property 'toString' I have this code and this error in FireBug: Error: Permiss… How To Add Date Time Value To Input By Onclick Checked JQuery i have this Solution 1: jsFiddle Demo var months = n… External API GET() Request Using JQuery I am using the IMDb API v2.0 located here and I decided to … JQuery - Renaming Checkboxes Sets Consecutively I'm trying to build a form to allow multiple elements (… Dropdown Menu On Refresh Changes Javascript I have implemented a navbar uisng bootstrap 4,in which I ha… How Do I Use Data From Vue.js Child Component Within Parent Component? I have a form component where I use a child component. I wa… Uncaught TypeError: $(...).tooltipster Is Not A Function I can't use the tooltipster library along with tablesor… Add Two Conditions In Filter Javascript Im trying to add two conditions in filter but only one work… JavaScript Object Check For Key -- But Ignore Case Normally, I would do it like this if (key in obj) { //o… December 2024 (1) November 2024 (35) October 2024 (68) September 2024 (25) August 2024 (371) July 2024 (334) June 2024 (705) May 2024 (1290) April 2024 (788) March 2024 (1543) February 2024 (1653) January 2024 (1323) December 2023 (1379) November 2023 (392) October 2023 (493) September 2023 (299) August 2023 (352) July 2023 (269) June 2023 (351) May 2023 (209) April 2023 (127) March 2023 (150) February 2023 (182) January 2023 (282) December 2022 (132) November 2022 (230) October 2022 (172) September 2022 (170) August 2022 (496) July 2022 (303) June 2022 (266) Menu Halaman Statis Beranda © 2022 - JavaScript OfficialSite