Tagged Questions
JavaScript is a dynamically-typed language commonly used for client-side scripting. Use this tag for questions regarding ECMAScript and its dialects/implementations (excluding ActionScript). Unless a tag for a framework/library is also included, a pure JavaScript answer is expected.
1
vote
6answers
31 views
How to delete an element in jQuery with a specific child?
HTML:
<p><br style="clear:both;"></p>
I'm using the Wikipedia API for a project, and I'm cleaning up Wikipedia's raw HTML output and I've been struggling with this problem. How ...
-1
votes
2answers
53 views
Conditional Assignment for Negation [on hold]
Is there a way to conditionally negate a value or expression without having to use a conditional evaluation? Such as the following:
result = (condition) ? value : -value;
result = value * ...
2
votes
6answers
417 views
jquery replace not replacing all spaces with -
Why is my jquery not replacing all spaces with a '-'. It only replaces the first space with a '-'
$('.modhForm').submit(function(event) {
var $this = $(this),
action = ...
0
votes
0answers
6 views
from javascript to php to javascript -need correction
im making something and this code isnt working
<script src='jq.js'></script>
<script>
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + ...
0
votes
1answer
11 views
jQuery Div inside Div
Hi i'm trying to have some photogallery with jQuery.. This is my code :
<script>
$("#vsetky").click(function(){
$("#obrazky").show();
});
$("#c").click(function(){
...
0
votes
0answers
2 views
How do assertion libraries such as Chai work without forcing a call to a function?
In Chai, you can do stuff like the following:
expect({}).to.exist;
exist is not a function call, but this still works in testing frameworks. The opposite (expect({}).to.not.exist) causes tests to ...
0
votes
1answer
10 views
Globalize.js - how to parse date and time rather than just date
Globalize.js allows you to parse a date string based on the current culture applied
var date = Globalize.parseDate("17/07/2013"); //Wed Jul 17 00:00:00 PDT 2013
What I would like to do is parse a ...
0
votes
1answer
10 views
Escape special characters when building html code using javascript
Hi I would like to build html code dynamically using javascript. The problem is it gives me an syntax error when I try to specify css class for the table using . I think I need to escape the special ...
0
votes
0answers
4 views
Change popup window to include HTML
I have a popup window triggered by Ajax upon form submission. Currently it works fine, but I want to edit the code so that it will show HTML content (instead of "Added to cart, thank you!", the ...
0
votes
0answers
2 views
grunt-contrib-handlebars output is different from handlebars npm task
My issue is very similar to grunt-contrib-handlebars - Output is different than when I run the handlebars npm task, but no one has answered that question so I thought I'd start my own.
I'm trying to ...
0
votes
0answers
11 views
Double backslash on quotes when JSON stringifying an array of strings
I'm trying to stringify a JSON object that contains a string with quotes inside of it:
array = ['"foo"']
However, the string is created as: '["\\"wat\\""]' when I was hoping for something more ...
0
votes
0answers
12 views
Why don't image/anchor attributes change correctly in Firefox?
I asked this question trying to find a way around the following behavior. (And I'd still like an answer, if anybody has one.)
Note: this behavior only fully applies to Firefox (IE handles it as I ...
0
votes
3answers
33 views
Create JS Object Literal with Uninitialized Members
In JavaScript, is there a way to create object literals with uninitialized instance variables?
The purpose would be to allow for iterating through the members using a for-in loop to initialize them ...
0
votes
2answers
11 views
Uncaught TypeError: cannot call method 'cookie' of undefined
Please help!!! I am trying to set this cookie but it is not working. I get an error message that says "Uncaught TypeError: cannot call method 'cookie' of undefined". I dont know why it is saying this. ...
0
votes
2answers
27 views
Running script with onclick event when only inside a particular div element
I'm looking at running this script:
$(document).ready(function() {
$('a').click(function(e) {
var urlyep=(this)
e.preventDefault();
...
0
votes
3answers
40 views
Replacing inner nested quotes in a string using Regular Expression
I have a String: "The name is "Rambo"."
I would like to replace the inner quotes with " using regex so the output would look like:
"The name is "Rambo"."
1
vote
1answer
13 views
jquery slide menu - better way?
I'm pretty new to javascript/jquery and I just built a simple slide menu.
It has 3 menus and each menu has a submenu...everything is working fine, I just want to know if there's a better way to ...
0
votes
1answer
9 views
How to use PDF.js to load file included in web app (not from “file:” URL?
I want to be able to show PDF files within my Chrome app using PDF.js but the documentation is non-existent. I've been unable to find any simple examples or tutorials that show the code to load a PDF ...
282
votes
25answers
74k views
What is an elegant way to force browsers to reload cached CSS/JS files?
I have noticed that some browsers (in particular, Firefox and Opera) are very zealous in using cached copies of .css and .js files, even between browser sessions. This leads to a problem when you ...
0
votes
0answers
16 views
XML http request, document.getelementbyID breaks javascript
I'm very new to XML but even so I managed to get a working script thanks to w3school's site that loads in information from the file, here: http://www.w3schools.com/xml/xml_dom.asp . Unfortunately I've ...
0
votes
0answers
8 views
navbar collapses on mobile with chrome/safari on scroll
I am working on a responsive site with my own css not bootstrap.
On safari on the iphone and chrome on andriod the navigation is buggy.
If you open a category in the menu and try to scroll the menu ...
0
votes
2answers
13 views
Using CSS or JavaScript to limit the page size or limit positioning to prevent overlapping
I would like to add a footer to a page, but I don't want the footer to overlap the text if the user makes the page too small. How do I prevent this from happening without making a large table or a ...
1
vote
2answers
56 views
Insert text inside of a single word. Unique circumstance
I have a very strange out-of-the-box question but there's a good reason for it.
If I have a variable such as:
var myText = "Select an option, and we'll update you.";
I need to change it to:
...
0
votes
1answer
18 views
How to create a html drop down list control with custom styling?
Looking for a solution to create a drop down list control from select tags with custom styling(drop down arrow image and colors). Tried lot of JQuery plugins and CSS manipulations. But nothing is ...
0
votes
1answer
4 views
How do I place an image in a text frame using javascript in Indesign?
I am making a scripted community directory, and I am using script labels to find text boxes and fill them with appropriate information from a JSON file. The problem I am having is that I cannot figure ...
0
votes
1answer
7 views
Create a route using a list of coordinates in Google Maps
I have a list of lat,lon coordinates as result of tracking a bus. I'm showing the route using PolyLine to create a line to connect "the dots" but because of the accuracy these dots aren't exactly by ...
3
votes
2answers
209 views
Browsers Storage - physical Location?
According to :
localStorage.setItem( key , value ); // global - not per session
sessionStorage.setItem("username", "John"); //per session
question :
where does it actually save the storage ...
0
votes
1answer
6 views
Stacked Bar Chart using d3.js stack layout; the bar sections not always in correct place
Please see it in action here: http://jsfiddle.net/marrok/2fRBS/2/ (full code below)
I was adapting Mike Bostock's excellent stacked bar chart example: http://bl.ocks.org/mbostock/3943967
The Y ...
0
votes
1answer
34 views
create three circles using D3
I just started learning D3. From a tutorial website, I found the following code:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" ...
0
votes
2answers
35 views
Jquery , how append field value to id
Using
$("#input_text").appendTo("#somediv")
Appends the text field itself, I want to append it's value entered by user not itself.
Or if there a way to just use something like
...
0
votes
1answer
14 views
how to combine extjs graphical elements and easelJs elements
I want to combine an extjs app that creates a window and an easelJS canvas but when I try to load them at the same time the window's get completely screwed up :( here is my code. is there a conflict ...
1
vote
2answers
33 views
How to validate if multiselect array is empty in javascript?
How can i validate if the multiselect array is empty?(fallos[]) heres my code :
<tr><td>Fallos reportados: </td><td><select name="fallos[]" size="6" multiple="multiple" ...
2
votes
2answers
20 views
Trying to understand the concepts behind javascript event handlers
As a beginner in javascript, one is slightly confused with the
addEventListener()
function, as opposed to the use of
variable.onclick
Here is the code that I am testing it with
/*
* ...
0
votes
0answers
8 views
How to put superscript google chart title?
I have the next code
var title = 'hello<sup>2</sup>';
Now I'm using google charts and I want the 2 appear as a superscript.
I get
hello<sup>2</sup>
the code on the ...
-1
votes
0answers
13 views
html5 select camera in tablet
I am developing a web application to work specifically on tablets.
In the tablet (in my case Samsung Galaxy Tab 2) I installed the Chrome browser and enable WebRTC for me to recognize html5 syntax to ...
1
vote
2answers
61 views
Reading a a ReadableStream and specifying a size param: Why does state.highWaterMark always get passed to ._read() as the size?
In Node.js, I've got a Readable stream:
var rs = new (require('stream').Readable); ...
0
votes
1answer
16 views
Full screen iFrame load with ajax
Do you know any script which can help to achieve effect like on whis website: http://www.julianabicycles.com/
When you clik on any bike, you can see lightbox sizing effect, but most important is that ...
0
votes
0answers
15 views
Can Dictionary accept duplicate keys?
I have a Dictionary, and I want to search in this Dictionary by value, not by keys :-). I want to do it this way because Dictionary in JS doesn't have duplicate keys. I need to allow my program to ...
1
vote
3answers
34 views
Redirect to any page and submit form details
I'm looking to submit form details using method="POST" to an external URL, then redirect the user to a 'Thank you' page after successfully completing the form.
My sample HTML/Javascript is as ...
1
vote
1answer
19 views
Bind variables to callback function
I have a few functions in my controller which call some database functions. All of these database functions do "error callbacks", meaning that if a database error occur they do a separate callback ...
2
votes
1answer
46 views
Why doesn't using the search method to find a . work the way I expect in JavaScript?
In my js code, I'm trying to validate an email address.
var validateEmail = function () {
var email = $("email").value;
var symbol = email.search("@");
var domain = ...
0
votes
0answers
5 views
Google Charts not showing in IE 8
Hi I've got a basic chart that isn't showing in IE 8 or 9. Works in IE 10. The space is just blank. Here's the code:
var data = google.visualization.arrayToDataTable([['Month', ...
8
votes
3answers
7k views
Is there a way to check document.ready() if jQuery is not available? [duplicate]
Possible Duplicate:
$(document).ready equivalent without jQuery
I know you can use the window.onload event to make functions run, but is there a way for a script to query if the document is ...
0
votes
0answers
13 views
“Current” tab in tabbed content will not show when “all tabs” are toggled
Fiddle
I'm trying to create a jQuery script that allows for two events to occur:
Create tabbed content, where only the first tab's content (.current) is shown when the page is loaded
Create a ...
0
votes
1answer
8 views
How to change ExtJS ToolTip text in runtime?
According to number of questions and articles the simple tip.html = 'new value'; should work but for some reasons it's not the case for me.
Here I have created a demo to demonstrate that tip.html ...
0
votes
0answers
4 views
How do you use a texture atlas in cocos2d-javascript?
I'm crash coursing cocos2d-javascript with an extremely tight deadline and am finding very few javascript specific examples to draw from.
Currently I'm drawing sprites, moving them, then removing ...
1
vote
1answer
22 views
jQuery / JS - get input file image in base64 encoded
<input type="file" id="asd"/>
i would like to get the image in base64 once the user choosed that (before ssubmitting upload form)
So somenthing like :
$(input).on('change',function(){
var ...
0
votes
0answers
5 views
OSM output from call
I'm going to develop a map-based site with mapquest. I'm trying to get the array with coordinates of this callback.Any idea how to get this output?
thank you in advance
...
1
vote
1answer
37 views
CodeMirror HTML mode not working
I'm trying to style code samples with CodeMirror, but it works partially - it applies the selected theme to the textarea but the syntax is not highlighted.
There is my page:
<textarea ...
0
votes
0answers
18 views
Memory leak in Firefox with jQuery, AJAX, and HTML5 canvas
I'm polling my server using jQuery's ajax function and then using that data to update a canvas. I poll the server once each second (this is not done using setInterval(), in case you're wondering... I ...