jQuery image download code for your reference, the specific content is as follows
function downloadImage(src) { var $a = $("<a></a>").attr("href", src).attr("download", ""); $a[0].click(); }
Key call to downloadImage function code
onclick=downloadImage(url)
Complete js code
$(function () { $.extend($., $.['zh-CN']) var searchText = $('.search').find('input').val() var columns = [] ({ title: 'Classification', field: 'category', align: 'center', valign: 'middle', formatter: function (value, row, index) { return value } }, { title: 'Beautiful Picture', field: 'url', align: 'center', valign: 'middle', formatter: function (value, row, index) { return "" } }, { title: ' operate', field: 'id', align: 'center', formatter: function (value, row, index) { var html = "" html += "<div οnclick='addFavorite(" + value + ")' name='addFavorite' id='addFavorite" + value + "' class='btn btn-default'>collect</div><p>" html += "<div οnclick='deleteById(" + value + ")' name='delete' id='delete" + value + "' class='btn btn-default'>delete</div>" return html } }) $('#meituTable').bootstrapTable({ url: 'meituSearchJson', sidePagination: "server", queryParamsType: 'page,size', contentType: "application/x-www-form-urlencoded", method: 'get', striped: false, // Whether to display line interval color cache: false, //Does it use cache, the default is true, so in general, this property needs to be set (*) pagination: true, //Whether to display paging (*) paginationLoop: true, paginationHAlign: 'right', //right, left paginationVAlign: 'bottom', //bottom, top, both paginationDetailHAlign: 'left', //right, left paginationPreText: 'Previous page', paginationNextText: 'Next Page', search: true, searchText: searchText, searchTimeOut: 500, searchAlign: 'right', searchOnEnterKey: false, trimOnSearch: true, sortable: true, // Whether to enable sorting sortOrder: "desc", //sort by sortName: "id", pageNumber: 0, //Initialize the first page to load, default the first page pageSize: 10, //The number of records per page (*) pageList: [5, 10, 20, 50, 100], // Optional data per page totalField: 'totalPages', dataField: 'content', //Backend json corresponding table data key columns: columns, queryParams: function (params) { return { size: , page: , sortName: , sortOrder: , searchText: } }, classes: 'table table-responsive full-width', }) $(document).on('keydown', function (event) { // Keyboard page turn event var e = event || || [0]; if (e && == 38 || e && == 37) {//Up, left // Previous page $('.page-pre').click() } if (e && == 40 || e && == 39) {//Lower, right // Next page $('.page-next').click() } }) })
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.