I was about to create a trim function in javascript, but as i don't want to reinvent the wheel i googled for this method.
I found this link
http://www.somacon.com/p355.php
The Solution it provided is:
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
return thi...
Hey
I use edit-in-place plugin: http://arashkarimzadeh.com/jquery/7-editable-jquery-plugin.html
I't works Great!
I just need something to check if the new text is empty. If it is we have to go back and show some error alert.
The code:
$('.name').editable({
submit:'Gem',
cancel:'Fortryd', ...
Hi. I have about 2000 lines of javascript code for my application. A lot of this is user interaction / jQuery. Don't worry, it all works fine :)
But it's getting dificult to keep track of the code base. So I have split up the file into five files.
I thought that if I load all files, they all reside in memory and the can communicate wit...
Hello,
I'm running into a character encoding issue when I load a dropdown using jQuery from an external js file. This only seems to happen when the JavaScript object is not within the page.
For example the below is the JavaScript object.
var langs = [
{value:'zh-CN', text:'中文 (简体) Chinese Simplified'},
{value:'en', text:'English'...
Using CSS, there are basically two classes, one for the tabs default colour, and a "selected" CSS class that is applied using javascript to whichever tab is clicked.
The control fuctions perfectly, but the dynamic CSS only works in IE7 and IE8.
The code is basically this:
for (var i = 0; i < group.children.length; i++)
{
child = g...
While using fixed width select tag , there is one bug in IE. When the content of the option in the select tag is more than the width of select tag its hide. Its working fine in fire fox , not in IE.
...
Part of my code I get the OuterHTML propery
"<LI onclick="TabClicked(this, 'SearchName', 'TabGroup1');">Name "
so I can do stuff involing parsing it.
There is no OuterHTML property in javascript on firefox though and I can't find an alternative way to get this string. Ideas?
...
I need certain scripts to refire after an AJAX load. How could I accomplish this?
...
For better frontend performance, it's best practice to put your scripts at the very end of your HTML code.
I did that for a pretty big and complex page I'm working on right now and the problem I run into are many inline scripts in the views, mostly generated by Rails' built-in JavaScript helpers. These scripts depend on the libraries th...
Hi all ,
Is it possible to use the structs tags(logic:equal, logic:match) inside a javascript function? Actually I need to set value in the <td> of the table dynamically getting
from the Bean. How can I achieve this?
...
I would like to add a Javascript at the end of some ajax content,
It works fine on firefox but internet explorer print the script without running it.
<script type="text/javascript">
$.tablesorter.addParser({
id: 'title',
is: function(s)
{
return false;
},
format: function(s)
{
s= s....
After assigning this: window.onload = initfunction;
I want to append the AJAX cross domain script to the header:
function initfunction() {
var dh = document.getElementsByTagName('head')[0];
var script = null;
script = document.createElement('script');
script.setAttribute('src', 'http://whatever.com/cgi-bin/ACD/ACD.js?'+location.hr...
I have a grid, which I want to add a button at the top to get the data from a specific column for each row selected in the grid. How would I go about doing this?
...
Hi.
I've made a little forum and
I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"...
What's the best way ?
Thanx.
...
Is it possible to reload a form after 'file-input' change?
I have a form where the user can chose an image for upload. I also have a php script which displays that image resized.
I only wonder if it is possible to reload a form OnChange of the file-input and then call the php code which uploads the picture, so that the user can preview ...
Hey
Is it possible for someone to give me a few pointers on how to display a multidimensional array in the form of a bar graph?
The array is multidimensional, with three elements in each part - and the elements are determined by a HTML form.
So if it is possible to display this kind of array in the form of a bar graph in Javascript on...
Hi all,
I have a large javascript which I didn't write but I need to use it and I'm slowely going trough it trying to figure out what does it do and how, I'm using alert to print out what it does but now I came across strange alert output:
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[...
Is there a reliable way to access the client machine's clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use Flash?
My primary target is IE8, but would like to support FF and Chrome also.
I have seen the technique to do this using Flash, but am loo...
How do I pop up an alert in Javascript?
I tried alert"HELLO" but that didn't work.
Can someone tell me the correct syntax?
...
Hi all,
sry for this imprecise topic name.
I am querying a dataset a lot of times so using ajax request would end up in tons of http requests.
For this reason I decided to use the json encode method to store this particular data set in my javascript code.
My php code looks like this: (no json.parse)
echo 'var myDataset = ' . json...