skip to Main Content

Rails 7 JQuery Not Working, but Shows in Sources

I have a new Rails 7 app (using Bootstrap 5) that is having Jquery issues. For one example, I have this image gallery function that uses click() to addClass. $("#gallery1").click(function() { $(".gallery-image").removeClass("activeImg"); $("#gallery1").addClass("activeImg"); $(".expandedImg").addClass("hidden"); $("#expandedImg1").removeClass("hidden"); }); $("#gallery2").click(function(){ $(".gallery-image").removeClass("activeImg"); $("#gallery2").addClass("activeImg"); $(".expandedImg").addClass("hidden");…

VIEW QUESTION

How to select <a> tag using jQuery

In this way, I was trying to select the a tag but it has not been selected. How can I do this? <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script> (function($) { var test = $('.page_item').find('> a').text(); alert(test); })(jQuery) </script> </head>…

VIEW QUESTION

jQuery .attr() method returning undefined attribute value

The attr() method is returning "undefined" value of (v) when used with alert. Can someone help please? <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script> $(document).ready(function() { $("#decw").click(function() { $("#cht").attr("width",function(n, v) { alert(v); return v - 50; }); }); }); </script>…

VIEW QUESTION

Copy input value after page loaded – Jquery

How to get the text value from the SOURCE to the TARGET,after the page fully loaded? SOURCE <input id="gclid_field"> TARGET <input id="gclid_form"> SCRIPT window.addEventListener('load', function () { document.getElementById('gclid_field').value document.getElementById('gclid_form').setAttribute('value'); })

VIEW QUESTION
Back To Top
Search