Questions tagged [javascript]

449342 questions
1

votes
1

answer
943

Views

Offline storage for mobile devices?

I am writing a mobile website that needs to store some data offline, and to sync that data when there is an internet connection. It is possible to use HTML5 Web SQL Databases, but there's a space limit of 5MB. I am wondering: Can I create multiple databases in HTML5 Web SQL Databases, so that the to...
HQXU85
1

votes
1

answer
785

Views

Node.js supertest post gzipped data

I'd like to write a test to post up some zipped data to a url as follows, but it doesn't work: zlib.gzip('foo_bar_data', function (err, buffer) { request(app) .post('/foo/bar') .set('Content-Encoding', 'gzip') .send(buffer) .expect(200) .end(function(err, res){ if (err) return done(err); //various o...
user1328174
1

votes
2

answer
454

Views

Choosing same option in select list

What I have is a html select list that is populated through jquery. Right now I have the change event so that when I change the option, the map refocuses on the POI. I'm trying to make it work so that when I click on the same option, the map treats it as a change event. Options don't support click e...
Nixon
1

votes
3

answer
1.6k

Views

jquery click to hide and show another button

I have two buttons set as hidden : I have a jquery where I check some conditions fetched from the database. Either one of the button will be shown and that depends on if the condition is 1 or 0..That means when I click any of the button it must get hidden and the other one must shown up..? But it's...
user2605321
1

votes
1

answer
1.9k

Views

Node.js Buffers and Binary Files

I'm reading a file using Node and attempting to send it as a multi part MIME post, but having problems with the file appearing corrupt at the receiving end. I read the file and prepare it for sending like so: fs.readFile("before.png", function(err,data) { // Snip content += data.slice(0,data.lengt...
1

votes
3

answer
69

Views

Textboxes matching table column width

I have this table with a textbox for each column (they are going to be used for filtering). The textboxes should be the same width as the corresponding column. This is as far as I've gotten (simplified version): http://jsfiddle.net/9uUpP/ Pseudo-code explaining what I am trying to do with my current...
1

votes
1

answer
86

Views

Generating a string literal from text in JavaScript

function printStringLiteral(theInput) { document.body.innerHTML += JSON.stringify(theInput.value) } Text to modify: Get string literal I'm trying to create a simple web page that accepts text as input and returns a string literal, but this web page doesn't display the string literal correctly after...
Anderson Green
1

votes
1

answer
1.1k

Views

Changing Firefox extension icon programmatically

I am building a Firefox extension which communicates with a web service. In my extension, I am required to change the extension icon in the toolbar based on the login status of the user. Is there a way for me to programmatically access the toolbar icon and then change the image for the toolbar icon?
Vivek R K
1

votes
1

answer
815

Views

D3 linear gradient to geojson path according its value

I have geojson file with line and each line has a different value (for example different speed) I would like to assign gradient colors to these lines according their speed values. Is it possible? I've found descriptions only for gradient for whole page or div. My code: var speed = d3.json("speed.geo...
Mary
1

votes
2

answer
1.1k

Views

Accessing stringified JSON objects

As another user in my other thread suggested to post another question here in regards to explaining how to access JSON Objects. The code I am using is: $(function () { $.getJSON( "https://api.guildwars2.com/v1/wvw/matches.json", function (data) { $("#reply").html(JSON.stringify(data)); // or work wi...
user2593573
1

votes
3

answer
86

Views

Assign and execute Javascript function simultaneously

Is there a more elegant way of writing something like this, where myFunction is asigned to the function func but func is also executed during the assignment? var myFunction = (function(){ var func = function(){ console.log('hello world'); }; func(); return func; })(); ... myFunction();
danbroooks
1

votes
1

answer
6.5k

Views

Display text over Canvas only onmouseover

I have created a triangle shaped image mask with the Canvas element. I have a field of text which I want to display at the bottom line of this triangle when mouse over. I can´t figure out how to make the text display only when hovering. I am a beginner at this... Any help appriciated! This is the...
Lisa
1

votes
3

answer
888

Views

URL not showing request parameters

I am taking some data from user-2 paramerters(using JS,html,jquery) , when user pclicks on GO, then calling servlet, passing these two parameters in get request: $.get("/Myservlet?param1="+myval+"®ion="+myregion,function(data){addToTables(data);hideLoading();},"text"); Servlet is returning data f...
ALBI
1

votes
2

answer
1.7k

Views

is there any options to display infoWindow automatically on page load

I'm using GMaps to display a map on my website. It is pretty easy to create a map with an infoWindow. However, the infoWindow only appears when the marker is clicked. My Javascript: var map; $(document).ready(function(){ map = new GMaps({ div: '#map', lat: 11.5671732, lng: 104.92592450000006, zoom:...
Tepken Vannkorn
1

votes
1

answer
3.5k

Views

Dropdownlist Onchange Show other Dropdownlist

My problem is I want to create a category selecting system with javascript but when I choose an option it displays all divs; it should show only one div. For example : if value = emlak then show div id=emlak JS function getData(dropdown) { var value = dropdown.options[dropdown.selectedIndex].value;...
TeknolojiGezgini
1

votes
4

answer
1.9k

Views

Get clicked linked on uiwebview navigating on m.youtube.com on ios

I use uiwebview on my ios application. I have textbox above it and it navigates the uiwebview. I enter m.youtube.com and the webview perfectly loads it. I made a search on the youtube.com and the results is loaded perfectly. When I click any of the video I go to the video page, and I want to have th...
Bilgin Kılıç
1

votes
2

answer
37

Views

JavaScript full Object retrival inside from an object [duplicate]

This question already has an answer here: Access / process (nested) objects, arrays or JSON 20 answers I am new to JavaScript. I have an object like the below. Now I want to get the object "window" only. How can I do it? var jsonData = { "widget": { "debug": "on", "window": { "title": "Sample Konfa...
user2446802
1

votes
2

answer
2.4k

Views

Reliable way to determine the width of svg text styled with @font-face

I'm having an issue positioning css web-font styled, svg text elements one after another using D3. When I first position the text elements on load they'll overlap. However, when I position the elements moments later using the same function triggered on a delay or through a button they wont overlap....
Yanofsky
1

votes
1

answer
82

Views

Javascript - Editing a class instead of ID not working / Editing the heigh of a class

Well, I tried to make something with JavaScript, but it won't work. I played around with document.getElementById('idhere').innerHTML('whateverhere'); and what not, and it worked fine. Then I was going to edit an class using document.getElementsByClassName('classname').innerHTML('whateverhere'); but...
prk
1

votes
3

answer
59

Views

Create a function that uses a variable if it has already been initialized

My problem is this, there is a function out of the DOM that requires a variable that is initialized to load the DOM. The problem is even if the function is not invoked before loading the DOM, it creates this error: ReferenceError: variable is not defined. How to do so, preferably with an if statemen...
user2799274
1

votes
3

answer
1.8k

Views

javascript - onclick do something to the element inside

link link2 Whe the list is click, I wanted the display property of img inside that list become 'inline' function doSomething(obj) { //how to make inside the onclick display=inline } How to deal with this using that function call, I want it that way because I have an existing code formatted that wa...
Jam Ville
1

votes
1

answer
2.8k

Views

Ckeditor instance ready is not firing in chrome(some systems only)

Am using code as below: CKEDITOR.inline(document.getElementById('a'), { toolbar: ['Bold', 'Italic', 'Underline', '-', 'Strike', 'Subscript', 'Superscript'] }); CKEDITOR.on('instanceReady', function(ev) { alert("HI"); }); Ckeditor oninstanceready function is not firing in some system with chrome brow...
Vinoth Kumar
1

votes
1

answer
878

Views

Google Maps with Multiple Information in one marker

I am developing a web application that contains some information about place. That place may have more than one agenda. Can I show more information in one marker, such as stack balloon? This is my maps http://petamajelis.org/maps/index.php This is my data http://petamajelis.org/maps/ajax2.php there...
user2829199
1

votes
3

answer
2.3k

Views

passing an array from express to jade client side javascript

I have this jade template: html head script(type="text/javascript" src="https://www.google.com/jsapi") script(type='text/javascript') google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTa...
otmezger
1

votes
1

answer
82

Views

jquery- Adding <option> tag inside <select>

I have a drop down list like Value 2 Value 3 I want to add one extra tag at the top like Value 1 Value 2 Value 3 How can i do it with jquery.
1

votes
1

answer
1.2k

Views

ngModel reference when pushed into array

I am pushing a new order into the customer.orders array and everything works fine but it seems to reference the ngModel because if I now type something into the neworder.product model it updates the view at customer.orders.product. It seems to reset itself on refresh. Any ideas? Some Code: $scope.c...
Lorof
1

votes
2

answer
70

Views

How to make a plugin for Google Closure

I am currently using Closure/Plovr advanced mode to compile javascript. I want to add some custom functionality, such as string replacements and variable renaming. The important thing is that it requires parsed syntax. Is it possible to add this functionality? Is there an API for this or do I have...
ColBeseder
1

votes
7

answer
3.7k

Views

Javascript: String search for regex, starting at the end of the string

Is there a javascript string function that search a regex and it will start the search at the end? If not, what is the fastest and/or cleanest way to search the index of a regex starting from the end? example of regex: /]*>?/gi
Marl
1

votes
2

answer
190

Views

Google Map not shown

I write a web page, and inserted Google Map into it. But the map always not shown. I tried to use Firebug to see what happened, and found there are no errors. The div of map-canvas has been correctly replaced by Google Map API but that div not shown... I debugged this for several days, still no solu...
Lingfeng Xiong
1

votes
1

answer
2.6k

Views

Is it safe to use and update global variables in NodeJS?

I have a node server for loading certain scripts that can be written by anyone. I understand that when I fire up my Node server, modules load for the first time in the global scope. When one requests a page, it gets loaded by the "start server" callback; and I can use all the already loaded modules...
Gasim
1

votes
1

answer
5.7k

Views

On mouse hover show a div like jQuery Tooltip

Let consider fallowing scenario jhony ram lilly $(function() { $('p').hover(function() { $('#about').show(); }, function() { $('#about').hide(); }); }); Know on mouse hover on the p tag a div will showed,But it is taking always a fixed/absolute position,But I want to show it with respect to hov...
manchu
1

votes
1

answer
1.6k

Views

HighCharts: pie slices need background images

I'd like to use a background image for each of my pie chart's slices. Is this possible in High Charts? I can't find an option to specify a background image for each slice. Here's a simple fiddle I put together: http://jsfiddle.net/3KyeL/ (just putting this here in case it makes life easier for someo...
StackOverflowNewbie
1

votes
6

answer
1.3k

Views

How can I detect a html class with javascript?

I use these three lines of code to detect lesser internet explorer versions. Using javascript, how can I find out whether or not the lt-ie8 class is enabled for the element?
ben
1

votes
1

answer
192

Views

Dynamic added elements double effect after page transition

I have added dynamic from jQuery in my code, but when I go back one page and return to the page where the 's are added and you press them, they somehow click twice now. I have tried with an alert('something'); when I click: $(document).on('click', '#products a', function() { alert('something'); } A...
Emil Moe
1

votes
1

answer
1.6k

Views

How to highlight a jsTree node based on a specific value?

I am using jsTree to build my tree within Oracle APEX v4.2, which all works fine. What I am after and unsure how to do is, whenever a node in the tree starts with the letter 'S', within the whole tree, I would like to highlight these nodes only with a background colour of say yellow. Example of res...
tonyf
1

votes
1

answer
1.3k

Views

load image and then animate it with canvas/javascript

I'm completely new when it comes to canvas. I'm trying to draw an image onto the canvas and then animate it. Right now I'm having trouble drawing the image on screen. The image doesn't show at all. Here part of the code: var car = new Image(); car.src = "http://i.imgur.com/8jV4DEn.png"; car.x = 40;...
Nilzone-
1

votes
2

answer
1.1k

Views

Caching Google maps routes

I've got a geojson file with a bunch of points. I use Google Maps to get routing information between these points (using the JS API v3). Unfortunately I'm getting the OVER_QUERY_LIMIT error status back because I'm doing too many routing requests at a time. For now I've solved it by delaying my routi...
Tobbe
1

votes
2

answer
455

Views

Knockout Subscribe Syntax

How would I call a function inside "subscribe" instead of writing it inline? For example, if I have: function Car(name) { var self = this; self.name = name; self.isRed = ko.observable(isRed); self.isRed.subscribe(function (value) {console.log(this.name()}, this) } Everything works as expected and th...
user1821052
1

votes
1

answer
1.4k

Views

motion tracking javascript = html5/canvas game input/control

motion tracking with camera with javascript???? = input for game. is there a framework or something that might have this? other words...besides, keyboard, mouse, touchpad, xbox/ps3/usb joystick input i am wanting to further dig into camera motion detection, as a form of input / control for the game...
Ryan Sanders
1

votes
2

answer
822

Views

What's the reason that document.getElementById works but jquery doesn't?

This question might seem elementary to some but I can't get my head around it. I am working on a XMLHttpRequest Ajax file upload. the first step is to selected the fileUpload element that is on my page and for some reason javascript works but not query, here's the following two lines: var fileInput...
Mutu Yolbulan

View additional questions