Search results
30 lis 2012 · Here's a jQuery version if you like: jsFiddle example $("input[name=file1]").change(function() { var names = []; for (var i = 0; i < $(this).get(0).files.length; ++i) { names.push($(this).get(0).files[i].name); } $("input[name=file]").val(names); });
26 lut 2009 · You can take all your "selected values" by the name of the checkboxes and present them in a sting separated by ",". A nice way to do this is to use jQuery's $.map(): var selected_val = $.map($("input[name='d_name']:checked"), function(a) { return a.value; }).join(','); alert(selected_val);
Get the single value from a single select and an array of values from a multiple select and display their values.
1 maj 2021 · This post will discuss how to get all selected values of a multi-select dropdown list with jQuery. With jQuery, you can use the .val() method to get an array of the selected values on a multi-select dropdown list.
24 kwi 2024 · This post will discuss how to get all options of a select in JavaScript and jQuery. 1. Using jQuery. With jQuery, you can use the .each() method, which is a concise and less error-prone way to iterate over the DOM elements.
The jQuery element selector selects elements based on the element name. You can select all <p> elements on a page like this: $ ("p") Example. When a user clicks on a button, all <p> elements will be hidden: Example. $ (document).ready(function() { $ ("button").click(function() { $ ("p").hide(); }); Try it Yourself » The #id Selector.
23 kwi 2024 · In order to get the best performance using :selected, first select elements with a standard jQuery selector, then use .filter( ":selected" ), or precede the pseudo-selector with a tag name or some other selector.