jquery

assigning ID's to body tag using jquery

∥☆過路亽.° 提交于 2021-01-28 10:43:13
问题 Help on this guys, I have here a script that adds an ID on body tag this is the result I see <body id="xxx-cat"> with the script I'm using below <script> $(document).ready(function(){ // Edit xxx-cat to match desired category link id: $('body').attr("id","xxx-cat"); if ($('body[id]')) { var bid = $("body").attr("id"); // Keep the next command on one line $('div.droplinebar li a[class='+bid+']').addClass('current'); } }) </script> How can I make the ID's (1,2,3,4), because I have 4 pages and

Filter table with on data attribute with jQuery

余生长醉 提交于 2021-01-28 10:42:35
问题 I am trying to filter a table based on data attribute, instead on value inside the td tag. The problem is, that I can't get it to work, because I always get this error: Uncaught TypeError: Cannot call method 'match' of undefined $(document).ready(function(){ var elemens = $("td") searchInput = $("#search") searchInput.on('keyup',function(){ elemens.each(function(){ var re = new RegExp(searchInput.val(), 'gi'); if( $(this).data('gui').match(re) === null ) { $(this).parent('tr').hide(); }else{

how to sum values in jquery with realtime calculation

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-28 10:14:54
问题 I have this piece of code which i use for a realtime calculation. $(document).ready(function(){ $('#bread1').keyup(function(){ $('.totalbread1').text($('#bread1').val() * 2.5); // how many of bread1, multiply with 2.5 price }); $('#bread2').keyup(function(){ $('.totalbread2').text($('#bread2').val() * 3.5); }); $('#bread3').keyup(function(){ $('.totalbread3').text($('#bread3').val() * 4.5); }); }); How can i, on the same way calculate the realtime totalprice of all these, lets say in: <span

how to prevent the click event of the parent when its children is being dragged

落爺英雄遲暮 提交于 2021-01-28 10:14:05
问题 Here is a sample code: $('.bmc-div').click(function(e){ e.stopPropagation(); // console.log(e.target); if ($(e.target).hasClass('my-sticky')) { } else { canvas.add_sticky($(this)); } }); $('.bmc-div .sticky_container').sortable({ cursor: 'move', revert: true, helper: 'clone', // handle: ".element-handler", connectWith: '.bmc-div .sticky_container', scroll: true, cancel: null, opacity: 0.7, // axis: 'y', items: ".my-sticky", placeholder : "sticky-placeholder", containment: "#main", zIndex:

AJAX Request from 3 URLS to Populate Same Table

荒凉一梦 提交于 2021-01-28 10:13:03
问题 Is it possible to have 3 different AJAX requests, and have them all populate to the same DataTable(table)? I have tried and tried to create a AJAX with multiple URLS and it didn't work, but when I used just one URL, it works fine. The issue is I need to pull from three different subsites. Here is my code: $(document).ready(function() { $('#myTable').DataTable({ 'ajax': { 'url': "_api/web/lists/getbytitle('XDeliverables')/items?$select=Program, Deliverable, To, Date, Approved, Notes", 'headers

document.getElementById not working on jquery load

本小妞迷上赌 提交于 2021-01-28 09:55:32
问题 I've loaded an html file with jquery load function in my profile.blade.php <script type="text/javascript"> $(document).ready(function(){ $("#newJob").load('/company/new-job'); }); </script> <script src="js/location.js"></script> in my location.js i am using document.getElementById('autocomplete') for getting an html element but this element is in company/new-job file the problem i got undefined error in document.getElementById('autocomplete') this part when i directly include the location.js

document.getElementById not working on jquery load

[亡魂溺海] 提交于 2021-01-28 09:53:45
问题 I've loaded an html file with jquery load function in my profile.blade.php <script type="text/javascript"> $(document).ready(function(){ $("#newJob").load('/company/new-job'); }); </script> <script src="js/location.js"></script> in my location.js i am using document.getElementById('autocomplete') for getting an html element but this element is in company/new-job file the problem i got undefined error in document.getElementById('autocomplete') this part when i directly include the location.js

how to convert nested object into array of array

为君一笑 提交于 2021-01-28 09:52:15
问题 Hi i have a situation where i want to convert array of object into array of array here is my targeted array of objects which looks like this (32) [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]0: Object1: Object2: Object3: Object4: Object5: Object6: Object7: Object8: Object9: Object10:

how can I bind event of one or more arithmatic operation to checkbox?

梦想与她 提交于 2021-01-28 09:47:02
问题 here is my form in which there are 4 checkboxes for 4 operations. <form action="" method="POST"> Select no.of questions:<input type="number" name="que" value="que"> <br> <br> Select no. of series: <select name="select_box"> <option value="0">Please Select</option> <option value="1"> 2 </option> <option value="2"> 3 </option> </select> <br><br> Select number type(in digits) <input type="number" name="digits" value="digits"> <br><br> Select operations:<br /> <input type="checkbox" id="add" name

Loop CSS typewriter effect and change text

ε祈祈猫儿з 提交于 2021-01-28 09:38:04
问题 I need to loop through the CSS typewriter effect, and change the text for each loop. Here is the code I'm using for the typewriter effect. I'm guessing I need to use javascript, but I am not sure how to go about this. Any ideas on how I could do this? .typewriter h1 { overflow: hidden; /* Ensures the content is not revealed until the animation */ border-right: .15em solid orange; /* The typwriter cursor */ white-space: nowrap; /* Keeps the content on a single line */ margin: 0 auto; /* Gives