[Solved] Can’t attach local Javascript file to HTML

The src path is relative to the html file. If both are in the same directory, then try: <script type=”text/javascript” src=”https://stackoverflow.com/questions/31767363/Application.js”></script> if in a subdirectory <script type=”text/javascript” src=”https://stackoverflow.com/questions/31767363/dirName/Application.js”></script> if in a parent directory <script type=”text/javascript” src=”https://stackoverflow.com/questions/31767363/Application.js”></script> However, make sure that the JS file is somewhere in the hierarchy of the root directory of your website, … Read more

[Solved] Combining nested objects [closed]

I propose a solution for a input as an array of objects and an output as an object var data = [{question: “FirtName”, answer: “Daniel”}, {question: “LastNane”, answer: “Daniel2”}, {question: “Age”, answer: 80} ]; var result = {}; data.forEach(x => { result[x.question] = x.answer; }); console.log(result); 1 solved Combining nested objects [closed]

[Solved] Displaying marker with latlong json data in Biostall-google-maps-V3 API Library issue

The problem is google.maps.LatLng is expecting two numbers and you are passing it a string from your database (assuming searchMapDataResult[‘latlong’] is returning a comma delimited string). So you will need to Split the latitude and longitude Convert them into numbers Generate the google.maps.LatLng Like this: var latLngArray = searchMapDataResult[‘latlong’].split(‘,’); var latitude = parseFloat(latLngArray[0]); var longitude … Read more

[Solved] Explain some javascript/jquery code [closed]

Did you try asking google? http://api.jquery.com/jQuery.ajax/ url: A string containing the URL to which the request is sent. data: Data to be sent to the server. It is converted to a query string, if not already a string. success(data, textStatus, jqXHR): A function to be called if the request succeeds. solved Explain some javascript/jquery code … Read more

[Solved] Trigger callback after clicking N times

Without jQuery: document.addEventListener(“DOMContentLoaded”, function(event) { var button = document.getElementById(‘click_me’); var elem = document.getElementById(‘message’); var count = 0; button.addEventListener(‘click’, function(e) { e.preventDefault(); count++; if(count == 5){ elem.style.display = ‘block’; } }, false); }); #message { background: #0f0; display: none; padding: 10px; } <button type=”button” id=”click_me”>Click Me</button> <div id=”message”>Hello World</div> With jQuery: $(function() { var count = … Read more

[Solved] Creating page layout [closed]

Responsive designs are not that easy that someone could just give you a boilerplate code. You need to define the problem you are facing: You have a webpage with a fixed markup, and you want only it’s layout to change by javascript? What is your markup, what is your css by default? How many parts … Read more

[Solved] Buttons must be pressed in a specific order to send the form – jquery

you can do something like this: foreach click on an answer button disabele the current button update the input value..and once the user clicks all answers button check if the combination is correct, if it is the case redirect your page. $(function () { var correct_order=”321″; var clicks=0; var max_clicks=$(‘.answer’).length; $(‘.answer’).click(function(e) { clicks++; $(‘#text1’).val($(‘#text1’).val()+$(this).data(‘info’)); $(this).attr(“disabled”, … Read more

[Solved] Toogle icon (play/pause), and stop when another button is clicked

Well, after a lot of research i could get something that for now it’s ok for me. I just want to share if anybody else gets my same problem This are my scripts (i needed to use 2) <script language=”javascript”> var currentsound; function play_pause(player) { var myAudio = document.getElementById(player); if(myAudio.paused) { myAudio.play(); } else{ myAudio.pause(); … Read more