Is there a method to be able to remove an item from an JavaScript array like from this array:
var ary = ['three', 'seven', 'eleven'];
And I do an function like whereas:
removeItem('seven', ary);
I've looked into splice() but that only removes by the position number, where I need something to remove an item by it's value.
...
Simply put: the jQuery object is a composite pattern. How do I add jQuery objects to it?
An example:
var e1 = $('#element1');
var e2 = $('#element2');
...
I know want to create a new jQuery object jq such that it is composed of e1 and e2. I want to be able to do something like the following:
var jq = $();
jq.addInjQueryObjects([e1,...
I have the following JSON response from a ajax-request.
var json = {
"response": {
"freeOfChargeProduct":{
"description":"Product",
"orderQty":5,
"productName":"XYZ",
"qty":6,
"details": {
"price" : 55.5,
"instock": "true",
"focQuantity":1
}
},
"orderLineId":4788,
"totalOrderLinePrice":"741.36",
"totalOrd...
I want to let the user click on a file (let's say a .doc link) in the browser and it will open the native desktop application (microsoft word in this case).
And when the user saves the document it will be saved in the web.
Is there a way doing this with Javascript/HTML 5 or does the user have to download the file to be able to open it ...
I'm trying to use jQuery .button() on a checkbox, but i can't understand why this is'not working.
this is the javascript code:
$('#login_checkbox').button();
and this is the html code:
<input id="login_checkbox" type="checkbox" value="login_remember"/><label>Remember me</label>
I'm doing everything exacly as shown here: http://jqu...
Ok the question is quite simple.
I'm looking for a string like this one :
name="some_text_0_some_text"
I have HTML code before and after the string above.
Now i would like to replace the 0 by something like : !NEW_ID!
So i made a simple regex :
.*name="\w+(\d+)\w+".*
But i don't see how to replace exclusively the captured block....
Hi,
i want to make two links.
1. click here to generate CSV file.
2. click here to download the CSV file.
the problem is that i want the second file to appear only if the first link was clicked.
can someone help?
thanks,
Sebastian
EDIT: i forgot to mention that my table is built up in a while statement.
...
Hello!
I am working on a website for a client, he wants his tweets at the top of the page. I am confused as to how this is going to work. I have been working with some 3rd party stuff, but no success.
This is the page I am working on:
http://whiterhino.us/jason_tanzer/template.html
This is how I want it to look/work:
http://whiterhino...
I'm creating a table in javascript dynamically. The table I'm creating is 100 rows by 3 columns. Currently I have my own DynamicArray class that I use to make Javascript's Array object work more like C++'s vector class.
Here is the basic logic for generating the HTML:
function BuildTable( data )
{
var div = document.getElementById(...
I am trying to implement a simple fold/unforld effect for elastic div's, i.e. when actual dimensions of an element are not set through CSS and thus are not trivially determinable. So I need equivalents of jQuery's width() and height() for arbitrary elements; the methods should return something that would be assignable to *.style.width/he...
I have been using javascript for a while now and am starting to realise how badly I have been using the language. Some more advanced aspects of it are comming to light such as closures, module pattern etc.
Can someone explain how the () operator works when placed at the end of a function i.e. why does it immediately invoke it - i haven...
I am trying to write tests for a date helper class. I am wondering what is best practice for this.
Here is an example in PHP.
public static function get_date($offset = 0){
$date = mktime(0, 0, 0, date('m') , date('d') + $offset, date('Y'));
return array(
'day' => date('D',$date),
'month' =...
Hi,
I'm looking at adding a rating system to my site, similar to that seen on Amazon. Basically users can rate the product out of 5 stars.
I've been racking my brains to think of the calculation to get the average customer rating... but I can't think how to do it.
And looking at Amazon's system, I think their caculation may be incorre...
How would I go about removing all of the child elements of a DOM node in JavaScript?
Say I have the following (ugly) HTML:
<p id="foo">
<span>hello</span>
<div>world</div>
</p>
And I grab the node I want like so:
var myNode = document.getElementById("foo");
How could I remove the children of foo so that just <p id="foo"></...
I've been looking into Javascript prototyping recently, can understand the theory, and believe it can be very useful to my understanding of the language, but can't quite get the following to work...
var player = function(){//Declarations here};
var super_player.prototype = new player();
Every compiler/checker flags a 'missing semicolo...
Hi
the string looks like this
"blabla blabla-5 amount-10 blabla direction-left"
How can I get the number just after "amount-", and the text just after "direction-" ?
...
I have this button, and when clicked, it sends an ajax call which changes the value of score_up.
I dont see what the problem is. I tried firbug, but apparently it's not even detecting the javscript? :)) Thanks.
jquery:
$('.stats').delegate('.support', 'click', function(e) {
//stop event
e.preventDefault();
//get th...
How to find the text description of what 'this' currently points to in javascript.
i have tried this.name but just get undefined.
...
I have an HTML table with about 100 rows and 3 columns. I have onclick events attached to all 3 of my column headers. What must I do in Javascript to easily sort the table by that column? I can think of a fully blown hand-written approach, but I'm not sure if there are any built-in functions for such a seemingly common operation.
If I h...
I'm trying to write a chat client using javascript, but I'm being hindered by only being able to communicate with the server using XMLHttpRequest which as far as I can tell is completely unsuitable, as many have told me.
I've looked for other networking functions but haven't found any and been told that there aren't any. It's almost eno...