Skip to content
Fix Code Error

Tag: jquery

Animating Elements in One by One

July 17, 2021 by Code Error

Posted By: Anonymous I am trying to make an on scroll jQuery sequence that animates elements in one after the other when it’s in view. Here is my CodePen and here is the code: $(document).ready( function() { var $window = $(window); var $animatedItem = $(‘.has-animation’); $animatedItem.css({ "visibility": "hidden" }); // Check if in view. function …

Continue Reading

Set bootstrap data-toggle inside tag dynamically through javascript

July 17, 2021 by Code Error

Posted By: Anonymous I am trying to dynamically create datatables in tabs based on an input and so far I have no problems creating the datatables and tabs. However, when I click on the tab, i cant toggle to the data I want. I have no problems doing it manually like this: <a href="#tabTable2" data-toggle="tab" …

Continue Reading

Use of Jquery on scroll event

July 17, 2021 by Code Error

Posted By: Anonymous I am unable to show text in console.log when I scroll the page. _x000D_ _x000D_ $(“#idOfUl”).on(‘scroll’, function() { console.log(‘Event Fired’); }); _x000D_ <script src=”https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> <div id=”idOfUl”> <ul> <li> You can use the overflow property when you want to have better control of the layout. The default value is visible. You can use …

Continue Reading

Very simple second countdown with jQuery

July 17, 2021 by Code Error

Posted By: Anonymous I am trying to create a very simple count down just for the second. The message pop up, say something like "You will be redirected in ‘X’ seconds." That ‘X’ depends on what our end-user put in. Not sure why my code is not working. _x000D_ _x000D_ if($(‘.ty’).find(‘.form-ty-redirect’).length !== 0){ // alert(“redirect …

Continue Reading

Unable to send the data from view to controller Asp.net MVC using Jquery

July 17, 2021 by Code Error

Posted By: Anonymous I am trying to post the data from my View to controller, but the count is always 0. I can see in the developer console the data is passed as part of the request but my action method is unable to receive it, I am unable to figure the issue here. Data …

Continue Reading

How to traverse to access sibling element with jquery

July 17, 2021 by Code Error

Posted By: Anonymous I have the following html: <div class="tab-navigation" style="padding-bottom: 10px;"> <button class="btn btn-solid navigate" value="1"> Previous </button> <button class="btn btn-solid navigate" value="3" id="Stock"> Next </button> </div> <div class="row justify-content-md-center el-selection vertical-align selectedBtnOption" data-type="Stock" data-id="8"> <div class="col-md-3"> <img src="http://127.0.0.1:8000/storage/media/label-stock-white-bopp.svg" alt="" class="w-100 img-fluid blur-up image_zoom_cls-0 lazyloaded"> </div> <div class="col-md-6"> <h6 class="product-title">White BOPP</h6> <button class="btn btn-outline …

Continue Reading

Getting back object Object from validation using jquery ajax

July 17, 2021 by Code Error

Posted By: Anonymous In my jquery function I set up some validation so that if a user doesnt enter any data into these fields, it sends back a message saying "please enter + whatever field they missed". However when I test this in my application, the messages I get back say object Object instead of …

Continue Reading

Why is AJAX request response not matching the desired output?

July 16, 2021 by Code Error

Posted By: Anonymous I have this simple JS file: $.ajax({ url: "is_complete.php", type: "post", success: function (data) { if(data == 1) { } alert("ok") } }) It alerts "ok" only if data is 1 or 0. Solution why have you placed your alert outside the if condition. try replacing the success function to success: function …

Continue Reading

How does jQuery $(this) on Clicked element or class work?

July 16, 2021 by Code Error

Posted By: Anonymous I have a simple html snippet. <div class="group"> <div class="A1_B1 symptom"> <ul><li><a href="#" class="hit">Click Symptom</li></ul> </div> <div class="A2_B2 remedy"> <ul><li><a href="#" class="hit">Click Remedy</li></ul> </div> </div> Now for the click action… $(document).on("click", ".hit", function (ev) { if($(this).parents(".symptom")) alert("Symptom Clicked"); if($(this).parents(".remedy")) alert("Remedy Clicked"); }); $(this) is supposed to refer only the element that I …

Continue Reading

Passing Custom Variables to PayPal

July 16, 2021 by Code Error

Posted By: Anonymous I am trying to recreate this https://www.paypal.com/donate/?hosted_button_id=JA4LPSED5LVCG which is the standard hosted PayPal donation button. It has preset amounts, let the user add their intent(which program to support), and recurring monthly donations. I started out with jQuery to target elements and pass the preset amounts and that worked but since I’ve gone …

Continue Reading

Passport local strategy through custom fetch not displaying flash messages

July 16, 2021 by Code Error

Posted By: Anonymous I am using passport local strategy to enable user login. Earlier, my backend code was – passport.authenticate(‘local’, { successRedirect : ‘/dashboard’, failureRedirect : ‘/users/login’, failureFlash : true })(req, res, next) Later, I implemented a google recaptcha (which required a custom callback function using jquery/JS). This is as follows – document.getElementById("login-form").addEventListener(‘submit’, submitForm) function …

Continue Reading

switch custom using laravel , ajax

July 16, 2021 by Code Error

Posted By: Anonymous I have the following datatable : In My controller I have this function which gets data : function getdata(Request $request) { if(request()->ajax()) { return datatables()->of(Casting::latest()->get()) ->addColumn(‘action’, function($data){ $button = ‘<table><tr><td>’; $button .= ‘<button type="button" name="edit" id="’.$data->id.’" class="edit btn btn-primary btn-sm">Modifier</button>’; $button .= ‘</td><td>’; $button .= ‘<div class="custom-switch custom-switch-secondary-inverse mb-2 custom-switch-small"> <input class="custom-switch-input" …

Continue Reading

Delete parent and the clicked button container with inline jquery code

July 16, 2021 by Code Error

Posted By: Anonymous I have this code that adds some form and button addAdditionalBedroom: function (n) { //this.bedrooms_number_container = this.bedrooms_number_container + 1; $("."+n).append("<div class=’row blueDiv’ id=’"+n+"’><div class=’col-md-4′> <label>Types Of Beds</label> <select class=’form-control’><option>One</option><option>Two</option><option>Three</option><option>Four</option> </select> <br /></div><div class=’col-md-4′> <label>Number Of Beds</label> <input type=’number’ class=’form-control’ placeholder=’Number Of Beds’/></div><div class=’col-md-4′> <br /><button id=’"+n+"’ class=’btn btn-danger’ onclick=’$("+’#’+n+").remove()’>Delete</button></div></div>"); }, The function …

Continue Reading

Is there a more optimal way to write this jQuery code that adds a _blank attribute to targeted links (opens them in a new tab)?

July 16, 2021 by Code Error

Posted By: Anonymous Here’s the code I’m working with. Is this the optimal way to write it? Can I do better? // Open External URLs and PDFs in New Tab $(document).ready(function () { $(document).on("click", ‘a[href^="http"]’, function () { $(this).attr("target", "_blank"); }); $(document).on("click", ‘a[href$=".pdf"]’, function () { $(this).attr("target", "_blank"); }); }); Solution You can combine the …

Continue Reading

hover on an element and not affect others with same class name

July 16, 2021 by Code Error

Posted By: Anonymous Hi I’m struggling with something that probably seems simple (and maybe is) but I can’t figure out how to only affect the element I’m hovering over when there are other elements with the same class name. I’m obviously missing something but here is what I’m using and failing as it applies the …

Continue Reading

on input event not working on when using button value

July 16, 2021 by Code Error

Posted By: Anonymous I have here an input that getting it’s value from buttons. on input event not working when I want to get the value of the input. Please see code below for reference. _x000D_ _x000D_ var cashin_amount = 0; $(“.button-amount”).on(“click”, function (e) { e.preventDefault() var amount = $(this).text(); amount = amount.replace(“,”, “”); $(“#txtAmount”).val(amount); …

Continue Reading

Autodesk Forge Error trying to access the API online

July 15, 2021 by Code Error

Posted By: Anonymous I have a problem loading a 3D model on an online server, the error shown is related to accessing the Forge API, locally works smoothly however when mounted on the server or a website is made marks the following error "Failed to load resource: the server responded with a status of 404 …

Continue Reading

Bootstrap select pass value with disabled

July 15, 2021 by Code Error

Posted By: Anonymous I am using bootstrap Select, https://developer.snapappointments.com/bootstrap-select/ if ( $(‘#po_currency’).val() == $(‘#business_currency’).val() ) { $(‘.tax_rate’).selectpicker(); } else { $(‘.tax_rate’).selectpicker(‘val’, 4); $(‘.tax_rate’).prop(‘disabled’, true); $(‘.tax_rate’).selectpicker(‘refresh’); } I am using the above code, to set value as per condition, but when I disabled select picker, it does not pass value to the server, Is there any …

Continue Reading

jQuery API fetch request is not working. Console log shows working link. Link has results. What am I missing?

July 15, 2021 by Code Error

Posted By: Anonymous I am setting up a request to a brewery API. Simple code and it looks fine I have tried to troubleshoot it. I cannot figure out what the error is. Here is the js file that logs a working link but no fetch results So this is the link to the repl, …

Continue Reading

A-frame hide vr mode symbol

July 14, 2021 by Code Error

Posted By: Anonymous I have created a scene using a-frame and I cant figure out how to hide the vr mode in the bottom right hand corner of the screen. I have tried the vr-mode-ui="enabled: false" but for some reason it wasn’t working. How can I hide the vr mode in my scene? Here is …

Continue Reading

Find if attribute title matches with selected option value – jquery

July 14, 2021 by Code Error

Posted By: Anonymous I have scenario where I want to find value of selected option in div as image title and add class to it Select from: <table class="variations" cellspacing="0"> <tbody> <tr> <td class="label"><label for="pa_color">Color</label></td> <td class="value"> <select> <option value="">Izberi možnost</option> <option value="first" class="attached enabled">first</option> <option value="second" class="attached enabled">second</option> </select> </td> </tr> </tbody> </table> And …

Continue Reading

Creating a jQuery object from string deleting an element and returning the same string without the deleted element

July 14, 2021 by Code Error

Posted By: Anonymous s = ‘<div class="hero"><div id="myDiv"><span id="hello"></span></div><div id="my"><span id="hello"></span></div></div>’; var htmlObject = jQuery(s).find(‘#my’).remove(); //jquery call alert(jQuery(‘<div>’).append(jQuery(htmlObject).clone()).html()); This gives me: <div id="my"><span id="hello"></span></div> But I am expecting: <div class="hero"><div id="myDiv"><span id="hello"></span></div></div> I am looking for a way that doesn’t cause memory leak, and I would preferably not modify the DOM, because that’s the whole …

Continue Reading

jQuery AJAX call initiates without command when .done function added

July 14, 2021 by Code Error

Posted By: Anonymous I’m rewriting a series of jQuery AJAX requests and have been having trouble with .done code blocks. I’m attempting to send an AJAX request and wait for the response before processing the data. As a guide, I have been using the following page: http://michaelsoriano.com/working-with-jquerys-ajax-promises-and-deferred-objects/ I’ve also looked at countless stack questions to …

Continue Reading

Pass the parameter in jquery function as in javascript onclick

July 14, 2021 by Code Error

Posted By: Anonymous How to get the id in jquery "on" function as in javascript onclick function ? thanks in advance html @foreach ($datas as $key=>$data) <Button onclick="viewReturn(‘{{$data->id}}’)" class="get-data">Save</Button> @endforeach javascript function viewReturn(id) { $.ajax({ method: ‘Get’, url: basePath + "getData/" + id, }) } jquery $(document).on(‘click’, ‘get-data’, function(){ //how to get $data->id here? }) …

Continue Reading

How do I run my php function through Ajax and loop through the results?

July 14, 2021 by Code Error

Posted By: Anonymous So I am trying to build a simple search function for my website, and I don’t want to have to refresh the page to return results. The code that i have here works perfectly, But I don’t know how to Implement this using Jquery. I mainly have 2 pages, index.php and library.php …

Continue Reading

Jquery fadeToggle Trouble

July 14, 2021 by Code Error

Posted By: Anonymous I’m building a web app and am trying to incorporate animations to make it a little more pleasing to use. I’m new to the industry so I’m sure there is a better way of doing this so sorry in advance for the bad code! I have two menus: One is for ‘Sector’, …

Continue Reading

How to get the next sibling match in a list with different elements using JQuery

July 14, 2021 by Code Error

Posted By: Anonymous For some reason I’m having a problem with getting the next match in a list with <li> and <div>. I just need to match the next .infobox that matches after <li> that was clicked. <ul> <li /> <li /> <li /> <div class="infobox" /> <li /> <li /> <li /> <div class="infobox" …

Continue Reading

Merging of sub variables to fetch constructed variable

July 14, 2021 by Code Error

Posted By: Anonymous Is it possible that the merging of sub variables fetches the constructed variable? That’s my script: _x000D_ _x000D_ var a_b_c = 5000; console.log(a_b_c); // 5000 var el_a = ‘a’; var el_b = ‘b’; var el_c = ‘c’; console.log(el_a + ‘_’ + el_b + ‘_’ + el_c); // logs a_b_c _x000D_ _x000D_ _x000D_ …

Continue Reading

By clicking on different elements with the same css class, add css class to one of them but remove it from the others using jQuery

July 14, 2021 by Code Error

Posted By: Anonymous I want to add the text of specific div elements inside a textarea every time i click on each of those divs and style the one is active using jQuery: Here is my code: _x000D_ _x000D_ $(‘.msg-item-row’).each(function() { $(this).click(function(){ $(this).addClass(‘selected-msg’); var msgtextslot = $(this).text(); $(‘#message’).val(msgtextslot); //alert (msgtextslot); }); }); _x000D_ .msg-item-row { …

Continue Reading

How to get variable from $.getScript in jQuery

July 14, 2021 by Code Error

Posted By: Anonymous I have two functions country and location. When the page loads these two functions will run. I need to get the result value from $.getScript and use it in the function location(). Currently, I am getting undefined. Please check my code. Any help would be appreciated. <script> $(function () { var result; …

Continue Reading

Posts navigation

  • 1
  • 2
  • 3
  • 4
  • …
  • 130
  • Next

.net ajax android angular arrays aurelia backbone.js bash c++ css dataframe ember-data ember.js excel git html ios java javascript jquery json laravel linux list mysql next.js node.js pandas php polymer polymer-1.0 python python-3.x r reactjs regex sql sql-server string svelte typescript vue-component vue.js vuejs2 vuetify.js

  • you shouldn’t need to use z-index
  • No column in target database, but getting “The schema update is terminating because data loss might occur”
  • Angular – expected call-signature: ‘changePassword’ to have a typedeftslint(typedef)
  • trying to implement NativeAdFactory imports deprecated method by default in flutter java project
  • What should I use to get an attribute out of my foreign table in Laravel?
© 2022 Fix Code Error