jquery

jQuery Datatables, How to get all selected checkboxes from EVERY page

感情迁移 提交于 2021-01-27 20:10:35
问题 I'm trying to get all selected checkboxes via jQuery DataTables . Basically my code does as it should, but I'm only getting the checked boxes of the current DataTables page, I want to get the Data from every page. I am using this piece of code: var data = new Object(); $.each($('#addUsersToAboTable :checkbox:checked'),function(a,b){ data[a] = $(this).val(); }); Here is an example, the result is displayed in the console. $(document).ready(function(){ $('#addUsersToAboTable').DataTable(); $('

How to Export HTML to PDF (multiple pages) using jQuery?

我只是一个虾纸丫 提交于 2021-01-27 20:04:33
问题 I want to Export HTML to PDF using jQuery that is working fine but only for when HTML will finish in single page PDF. But I'm facing difficultly export html to PDF when there is lots of data in html and PDF pages may be more than one. My code: $("body").on("click", "#downloadPDF", function () { html2canvas($('#downloadPDFData')[0], { onrendered: function (canvas) { var data = canvas.toDataURL(); var docDefinition = { content: [{ image: data, width: 500 }] }; pdfMake.createPdf(docDefinition)

How do I outside-click-to-close this custom offcanvas nav from bootstrap's docs?

好久不见. 提交于 2021-01-27 20:03:10
问题 I'm using the offcanvas experiment code from Bootstrap 4 documentation, but it's not designed to close when you click outside the menu, which is something I would really like it to do. I've tried several of the jquery snippets around the web, but they utilize bootstrap's .collapse and don't work when I edit them to contain the custom .offcanvas-collapse class. <nav class="navbar fixed-top navbar-dark bg-dark"> <button class="navbar-toggler p-0 border-0" type="button" data-toggle="offcanvas"

Problem in animate scrollTop for multi div

こ雲淡風輕ζ 提交于 2021-01-27 19:50:53
问题 I have two div with id (# left-div - # right-div). In # left-div i have multi div with id and # left-div's overflow-y is scroll. In # right-div i have multi button with id. I want after click on each button, # left-div scroll to show Specific div that button clicked. I use jquery. How to create this action? This is my code: <div id="#left-div"> <div id="div1"></div> <div id="div2"></div> <div id="div3"></div> <div id="div4"></div> </div> <div id="#right-div"> <button id="btn1"></button>

Google Column Charts with Groups

自闭症网瘾萝莉.ら 提交于 2021-01-27 19:44:12
问题 My data format - ['Group','Count','Month','Year'], ['A',10,'February',2015], ['B',8,'February',2015], ['C',15,'February',2016] I will be using a filter to display data for each month separated by Group column. X-axis will have Groups. Y-Axis will have Counts for both all years (2014, 2015, 2016...). Something like this I am using Google Dashboard for this. My code- var dashboard = new google.visualization.Dashboard(document.getElementById('dashboard4_div')); var slider = new google

Check if element is into view and add class if so

大兔子大兔子 提交于 2021-01-27 19:40:38
问题 I'd like to stack elements and when they come into view, it adds the class .active . I don't want the class to be removed, so once it's added it stays there. General idea: If .default is in view on scroll add the class .active So as you scroll down it adds the class when it comes into view. After looking at similar questions I've come up with this: http://jsfiddle.net/x05vwb28/ $(window).scroll(function() { if (checkVisible($('.default'))) { $('.default').addClass('active'); } }); function

Loop through list of maps to filter map key-values using JS

大城市里の小女人 提交于 2021-01-27 19:36:38
问题 How to loop through list of maps to filter out SearchMap key-values from below List having map of records using JS? Map var searchMap = new Map() searchMap.set("ed_mood", "strong") searchMap.set("ed_target_audience", "Expert") searchMap.set("ed_clip_type", "intro") List var master_data = [ {ed_mood: "Light", ed_rating: 10, ed_target_audience: "Novice", ed_clip_type: "Basic"}, {ed_mood: "Light", ed_rating: 5, ed_target_audience: "Expert", ed_clip_type: "Q&A"}, {ed_mood: "Strong", ed_rating: 8,

jQuery datatable width changed wrongly at the time of resizing screen from small screen to large screen

╄→尐↘猪︶ㄣ 提交于 2021-01-27 19:30:46
问题 I have used responsive feature of datatable. For large screen, the view is like this: For small screen, the view is like this: Those views are completely fine. The issue arises when the page is loaded at small screen at first , after that if the screen is being resized to large screen , views looks like this: The width is not same as first screenshot. How to solve the issue? Working Demo 回答1: Try setting autoWidth: false var table = $('#example').DataTable({ autoWidth: false, responsive: ...

Add/remove class on click to change background color of a div

半世苍凉 提交于 2021-01-27 19:27:25
问题 I've been trying to get a little black div to change color to green on click and change it back to black on the next click. I want it to keep doing this. Unfortunately it doesn't seem to work and through checking other topics on this I couldn't find my answer. My HTML: <div id="block"></div> My CSS: div { width: 100px; height: 100px; background-color: black; } My jQuery: $(function(){ $("#block").click(function(){ if($(this).hasClass("faded") == false) { $(this).css("background-color", "green

Check if element is into view and add class if so

笑着哭i 提交于 2021-01-27 19:18:37
问题 I'd like to stack elements and when they come into view, it adds the class .active . I don't want the class to be removed, so once it's added it stays there. General idea: If .default is in view on scroll add the class .active So as you scroll down it adds the class when it comes into view. After looking at similar questions I've come up with this: http://jsfiddle.net/x05vwb28/ $(window).scroll(function() { if (checkVisible($('.default'))) { $('.default').addClass('active'); } }); function