javascript - Open download windows using jQuery's each() -


i've got table containing several rows each row represents exportable file, e. g.:

<tr>   <th class="text-center" scope="row">     <input id="exportid-23" type="checkbox" />   </th>   <td class="text-center text-nowrap">2016-08-24</td>   <td>name</td>   <td>city</td>   <td class="text-center text-nowrap">person</td> </tr> [...] <button id="exports" class="btn btn-success" type="button">   <span class="glyphicon glyphicon-export"></span> export </button> 

in order return files requested upon user's click on export button, wrote this:

$('#exports').click(function () {   var exports = $(this);    $('[id^=exportid-]').each(function () {     if (this.checked) {       window.open('ajax/get-exports.php?exportid=' + this.id.substring(9));     }   }); }); 

now, debugging code using firefox's developer console, each() works expected: new window each download.
however, running same code without debugger, opens new window last selected row.

unfortunately, couldn't find answer problem - neither here on nor elsewhere in depths of internet, so: doing wrong?

having developer console opened , executing code eliminates caching issue. can please ctrl + shift + del , clear cache , try executing code without developer console opened.

hope helps!


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -