This is my code $(currentClass).keypress(function (e) { if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) { return false; } }); The only problem with this is th...
When I add a marker and InfoWindow to my Google Maps application the marker is correctly added to both the map and the default StreetView panorama. I also add InfoWindows to both copies of the marker by calling my bindInfoWindow function once with t...
I have the folowing string variable returned from a textarea : jtext = $('#putJS').val(); The result of this string is the following: ctx.beginPath(); ctx.moveTo(172 + xoff, 29 + yoff); ctx.bezierCurveTo(183 + xoff, 33 + yoff, 199...
What is the correct way to remove and add a source/layers with Mapbox? I am using React, and have issues and get an error when a the source data prop is updated. As far as I have read in the documentation of Mapbox removeSource should remove it befor...
I want to get an index of clicked element var $inputs = $("input"); $inputs.click(function() { console.log($(this).index()) }); it works well for following structure div>(input+input+input) But I need it for this case div>inpu...
Actually I need a method which have same error message in javascript validation (client side) and in my django form validation (server side). I search for any django library for this but I didn't find any. This is the most relative question I fo...
In my Form I have Input fields as text, radio button and checkbox. I am binding function call on 'blur' of input fields. But I want to exclude Radio button. So that on change of 'Radio button' JS function should not get called. My c...
I'm trying to add a menu to my Javascript program that will allow a user to do a variety of different things. I'm not much of an HTML guru so I don't know how to keep the menu at the top and right of the page. I tried using a div, but it...
I am using JQuery to find a span element that contains a string of text in the class, but could also contain other text. var not_breaks = element.filter("span.this_text"); This works for spans where class="this_text" but not class...
I am trying to perform a simple indexOf on my array the thing is that it just looks for the entire text within my array node var arr = new Array(); arr.push("hello world"); var result = arr.indexOf("hello"); my problem is that the...
Okay so I have an object and I want to apply a callback function to all of the methods in the object. This is what I have tried so far: var namespace = { foo : 'bar', foobar : function() { console.log('call from foobar!')},...
I'm trying to make a little game just for the fun of it where i have some collision problems. I have a player drawn on a canvas and some blocks (16 x 16px) drawn on another canvas. But i have a problem with detecting horizontal collisions. ......
Given an attribute on an event that will be browser prefixed, I'd like to create a polyfill that makes it appear unprefixed. E.g. the interface FooEvent has an attribute webkitBar that I'd like to make appear as just bar so that handlers cou...
I have a multiline chart similar to this, where each line represent a particular year and the x-axis represents days(e.g. Jan 1, Jan 2, ... Dec 31) in that particular year. some lines are for leap years and some are for non-leap years. For a non-lea...
// project/layouts/main.hbs <!DOCTYPE html> <html lang="en"> <head> </head> <body> {{{@body}}} </body> </html> // project/views/home-public.hbs {{> nav-public}} <div class="container...
I'd like to fix this jquery left to right div on hover: http://jsfiddle.net/PXLJG HTML: <div class="holdingbox"> <span class="rightbox"> <span class="content">Kenyér</span> </span> <...
So I have this function where I've need to take out the evens and odds and put them into separate arrays but I need the evens array to print first rather than the odds. var numbersArray = [1,2,34,54,55,34,32,11,19,17,54,66,13]; function divider...
I am creating a dynamic span inside a span with some form elements and creating button with data-id inside the same dynamically by jquery append in span #add_more. I want to remove that particular span when button of that span is clicked. Step1....
I have a music sharing site and realize that the files on my site are not necessarily protected as they are stored in a subfolder in public_html. I need to protect them in a way that they still work for anyone in the music player, which located on a...
What are the best practices for securing a Meteor.js app, assuming that we have already taken care of CSRF attacks, have proper user input validation, removed auto-publish and insecure packages?...
I am trying to attach a drop event to an HTML div: document.getElementById('sub-main').addEventListener("drop", () => {console.log('DROP')}); but it does not fire. I have added a click event to test adding events and th...
I have some PNG's being moved around a screen in a repeated loop which I believe may be crashing some browsers. For example: function parachute_drop(drop_object, animation_duration) { $(drop_object) .animate({top: "750px"},...
I'm trying to use Firehose API (JS) and I keep getting the following error: "InvalidArgumentException: Firehose is unable to assume role arn:aws:iam::XXXXXXXXXX:role/NAME. Please check the role provided. I check the role and I have s...
I want to add focus on my input when it's displayed. In Firefox and Internet Exoplorer it's working fine but only in Chrome it's not working. Jquery Code: $(document).ready(function() { $('.magnifier').click(function() { $(&...
In my Rails app, the background consists of a fullscreen div with Google Maps and a traffic layer. This is what gets called on page load: $(function () { updateMap(); }); The updateMap function creates a Google Map on the div element 'goo...
I'm trying to do something like this if (pathArray.toLowerCase().indexOf("blah") != -1{} When debugging with console I get the error that "pathArray.toLowerCase is not a function". Why do I get that message?...
I have a question to improve my comprehension of react hooks. Its said that if one passes the set state functions or hooks to the children its bad practice. So one should just pass a handler function to the child which is located in the parent and th...
I'm encountering two problem with my Google API Project. First, I've been working with this project for several weeks but the past couple days I have started seeing this error in my console. Everything works fine, I just get this annoying m...
I want to close all alert-box items on a page after 3 seconds. I could just do window.setTimeout ( -> $('.alert-box').remove() return ), 3000 But that does not do the same as clicking the x button in an alert. It does not animat...
Math.floor() rounds the decimal to "A number representing the largest integer less than or equal to the specified number." So Math.floor(45.03) will be 45 and Math.floor(-34.23) will be 35. And Math.random generates a (decimal, or whole) num...