[Solved] Second AJAX call to one div element not working

The jQuery function takes one function to execute on the document ready event, not two: jQuery( function() { $(“#profEdit”).click(function() { $(“#profInfo”).load(“profile_edit_info.php”); }); $(“#profEditDone”).click(function() { $(“#profInfo”).load(“profile_info.php”); }); } ); Chances are it was simply ignoring the second function because it doesn’t expect a second function parameter after executing the first one. Note also that if these … Read more

[Solved] jQuery AJAX not receiving JSON from http request

For better understanding you can call ajax method as below $.ajax({ url: ‘https://prod.api.pvp.net/api/lol/euw/v1.1/summoner/by-name/kerrie?api_key=[key]’, type: ‘GET’, dataType: ‘JSON’, async: false, error: function(){}, success: function(resp){ // resp variable will be your JSON responce } } }); 1 solved jQuery AJAX not receiving JSON from http request

[Solved] Mobile number format [closed]

Check if the first character is a zero, if so replace it with 234. Note that the string replace method only will replace the first occurrence by default. $( ‘#button’ ).click(function() { var nr = $( ‘#nr’ ).val(); nr = nr.indexOf(‘0’) == 0 ? nr.replace(‘0′,’234’) : nr; $( ‘#result’ ).html(nr); }); <script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script> <input type=”text” … Read more

[Solved] How to change audio tag when I click on radio button?

Updated: <!DOCTYPE html> <html> <head> <title>Events</title> </head> <body> <input type=”radio” value=”test2″ name=”rad” onclick=”boom(this.value);”>test2 <input type=”radio” value=”test3″ name=”rad” onclick=”boom(this.value);”>test3 <input type=”radio” value=”test4″ name=”rad” onclick=”boom(this.value);”>test4 <br> <audio id=”audio” controls> <source src=”” type=”audio/ogg”> <source src=”” type=”audio/mpeg”> <source src=”https://stackoverflow.com/questions/37552235/test1.wav” type=”audio/wav” id=”sound”> </audio> <script type=”text/javascript”> function boom(val){ var audio = document.getElementById(“audio”); var aud = document.getElementById(“sound”); aud.src=val+”.wav”; audio.load(); } </script> </body> … Read more

[Solved] “$ is not defined” jQuery bottom with PHP include

If you replace the “$(function(){” section with window.onload you can ensure that all script files have been loaded before attempting to fire your function. However, be aware that this fires much later that jQuery’s document.ready. jQuery’s method fires when the dom is loaded whereas window.onload waits until the whole document and it’s scripts have been … Read more

[Solved] js: check if 2 elements has the same class and do something

If I understand correctly, when div.element1 is clicked on, you want find div.element1 on object2 and if it exists scroll to it. You can usee something like this: $(“.object1 > div”).click(function (){ var class = $(this).attr(“class”); if ($(“.object2 > div.” + class).length > 0){ var matchingDivOn2ndObject = $(“.object2 > div.” + class)[0]; $(‘html, body’).animate({ scrollTop: … Read more

[Solved] Toggle and give width to another DIV [closed]

$(‘.left-sidebar’).click(function(e){ var originalWidth = $(this).width(); $(this).animate({width: ‘0px’}, 400, linear, function(e){ $(this).hide(); }); $(‘.right-sidebar’).animate({width: originalWidth}, 400, linear); }); Assumptions: Left sidebar has class “left-sidebar”, right sidebar has class “right-sidebar”. The left sidebar needs to be hidden after it is animated. Explore .animate() for customization. 1 solved Toggle and give width to another DIV [closed]