jquery

why does “HTML file select” changes the order of selected files and sort them alphabetically?

☆樱花仙子☆ 提交于 2021-02-08 05:15:15
问题 I am trying to get the name of the files that are selected by a "file" input in HTML: <input type="file" class="filestyle" name="file-select[]" id="file-select" accept="image/*" multiple> I wrote this JavaScript code to do that: $('#file-select').on("change", function(){ var selectedFiless = this.files; for (var i = 0; i < selectedFiless.length; ++i) { var name = selectedFiless.item(i).name; alert(name); } }); However, I noticed that the names are sorted in alphabetical order, not in

Select only one checkbox in group

☆樱花仙子☆ 提交于 2021-02-08 05:14:44
问题 I need in html select only one checkbox in a group. I find my example. But I can't realize it. It doesn't works. Here is my example: example Here is my code HTML: <div> <li> <div class="radio"> <label> <input type="checkbox" name="mobil[1][]" id="optionsRadios1" value="1" checked class="radi"> Сотовый телефон имеется </label> </div> </li> <li> <div class="radio"> <label> <input type="checkbox" name="mobil[1][]" id="optionsRadios2" value="0" class="radi"> Сотовый телефон не имеется </label> <

Send an Ajax Call on beforeunload/unload

偶尔善良 提交于 2021-02-08 05:14:35
问题 Scenario: I am creating an event registration module in which a user would choose a date from a calendar for booking, fill some input fields and pay up to book the date. One of the requirements is that, there can be only one booking per date. This arises a case where two people want to book the same date on the same time. So, we need to show the user who came later to book the date a message that a booking is already in progress for that specific date. Please check back later . For this to

why does “HTML file select” changes the order of selected files and sort them alphabetically?

三世轮回 提交于 2021-02-08 05:13:38
问题 I am trying to get the name of the files that are selected by a "file" input in HTML: <input type="file" class="filestyle" name="file-select[]" id="file-select" accept="image/*" multiple> I wrote this JavaScript code to do that: $('#file-select').on("change", function(){ var selectedFiless = this.files; for (var i = 0; i < selectedFiless.length; ++i) { var name = selectedFiless.item(i).name; alert(name); } }); However, I noticed that the names are sorted in alphabetical order, not in

jQuery Datatables - retrieving information from other pages

痴心易碎 提交于 2021-02-08 05:09:51
问题 I have got a problem with getting information from jQuery datatable. Here is the table: I would like to get information stored in the table. I have tried to do this by this: var languages=[]; var people=[]; $("select[name='languageID']").each(function(){ languages.push( $(this).val() ); }); $("input:hidden[name='personID']").each(function(){ people.push( $(this).val() ); }); but it is getting values from current chosen page. If I run this in the situation like on the screenshot, only values

How to always display Bootstrap 3 modal?

微笑、不失礼 提交于 2021-02-08 04:51:25
问题 Bootstrap 3 modals are hidden by default. To launch them I have to click a trigger button: <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> Launch demo modal </button> JSFiddle I have tried the following but it has no effect: jQuery(window).load(function(){ jQuery('#myModal').modal('show'); }); How can I ensure my modal is always displayed on screen? i.e. I don't want the user to have to manually display it by clicking on the trigger button. I don't want them

from origin 'null' has been blocked by CORS policy: Cross origin requests [duplicate]

随声附和 提交于 2021-02-08 04:49:57
问题 This question already has answers here : “Cross origin requests are only supported for HTTP.” error when loading a local file (28 answers) Closed 1 year ago . This error occurred while calling up JSON. I don't know why this error is happening. $.getJSON(url, function(data){ console.log(data); }); Error: Access to XMLHttpRequest at (this is JSON URL) from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome

from origin 'null' has been blocked by CORS policy: Cross origin requests [duplicate]

一曲冷凌霜 提交于 2021-02-08 04:49:15
问题 This question already has answers here : “Cross origin requests are only supported for HTTP.” error when loading a local file (28 answers) Closed 1 year ago . This error occurred while calling up JSON. I don't know why this error is happening. $.getJSON(url, function(data){ console.log(data); }); Error: Access to XMLHttpRequest at (this is JSON URL) from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome

jQuery dropdown menu flickering

我只是一个虾纸丫 提交于 2021-02-08 04:47:34
问题 I'm having an issue with my dropdown menu which utilises the jquery slideDown and slideUp functions. If you have your mouse over the dropdown UL, if you move it out and back inside while it is still sliding up it starts flickering/flashing, as if it is firing the mouseenter and mouseleave event in rapid quickfire. I have setup a fiddle to illustrate the problem: http://jsfiddle.net/LxL8Q/3/ In Chrome, it only flickers for a second and then remedies itself, in Firefox however it continues

How to target elements set from innerHTML or .html() using jquery

∥☆過路亽.° 提交于 2021-02-08 04:46:26
问题 I have a div whose content gets dynamically generated from innerHTML and I cant seem to target those elements using jQuery for validation, Eg This is the page: <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"> <head> </head> <body> <span id="alert1">Alert1</span> <input type="button" value="Click Me" id="button1" /> <div id="empty"></div> </body> </html> and this is the js code: <script type = "text/javascript"> $(document).ready(function() { $('#button1').click(function() {