javascript

Why doesn't Jquery let me do this

document.getElementById("main").src = '02.jpg'; works but $('#main').src = '02.jpg'; doesn't ...

javascript reload and display message

Hi, I want to reload page after deleting a row from table, and then display message, below is the javascript code, if(action == 'delete'){ window.location.reload(true); //tried to set timeout here, no luck :( document.getElementById('messageSpan').innerHTML = "The value has been deleted."; } It seems that the reload function i...

Detect for website change via javascript / jquery

Is it possible to check if the browser user has opened a new tab, is closing (not minimizing) the current tab/page, or changing the url? Don't worry, nothing suss it's just for a novelty website. Could someone let me know if this is/isn't feasible via javascript (preferably jquery), and if so, what method to look into. Thanks EDIT: In t...

jQuery: split string and then insert into input and select

I have strings like this: "Car is blue" String could also be like this: "Flower is not at all beautiful" I have html like this: <input class="subject" /> <select class="isornot"> <option>is</option> <option>is not</option> </select> <input class="adjective" /> I need to split the string and put it into the appropriate pl...

Prevent Function Execution in Javascript and JQuery

Hi, I have such a code block and when code founds an error attribute which is set to error, then it should prevent further execution, how can I prevent it from execution : $(document).ready(function() { $("#SendMessage").click(function(e) { var elements = $("#contact-area input:text[error=error]").get(); for (var i ...

Missing template after link_to_remote

I'm using link_to_remote to update a partial on my page. The problem is that Rails isn't finding my partial. I am specifying the full path to my partial(an html.erb file) in the controller method: def my_method create something render :partial => '/shared/partials/my_partial_form', :layout => 'false' end I know the controller met...

Google Maps API v3 JavaScript EVENTS question

In Google Maps API v2, I used the following events to each perform different tasks. loaded tilesloaded moveend What is the equivalent of these events in API v3? ...

Toggled() text input field not working in IE6 in Jquery 1.3.2

In IE6 after showing() or toggling() an initially hidden text input field it is impossible to enter any text in the box. It is also impossible to focus() on the element. I am using jquery 1.3.2 Here is the code... Any ideas? $(document).ready(function(){ $(".hide").click(function(){ $(".form").toggle(); }) }) and ...

Jquery autocomplete

How do I customize the ac_results class generated by the autocomplete plugin? ...

javascript table like form manipulation

Basically I've got a form in a table. Each row of the table has some input fields. For example: col1 col2 row1 A C row2 B D Some of the input fields depend on others. When I type something in A, B and C, D is locked, and its value is automatically filled by the calculation of A, B and C. Also, the user can enter val...

Expanding the dimension of an element

I have a thumbnail. When i click on it, how can i enlarge it. I know there are many plugins that do this, but is there simple code that serve the purpose. ...

Favorites star switching in Javascript

A good example is the SO star on the left hand side of this post. You can click on it to add this message in your favorite and click again to remove this flag. I already create a page /favorites/add/{post_id}/ but how to handle that in Ajax ? Many things to do : Be sure that it worked when you click Change the image Change the link ...

on image load dosomething(this) in JQuery

I have an image $("#main") how can I use jquery to dosomething(this) when the image has loaded? ...

Mouseover for entire row in MVC

How to show and hide one particular column in Mouse Over and Mouse out receptively. on mouse over i want to show column in a single row and on mouse out i want to hide the column in that particular row. any answer will help me thanks in advance. ...

Use jQuery to mirror height of a dynamic element.

I have a sidebar on my page that I want to always be 100% of the container size. Sadly, I can't tell the element to do this via CSS alone as the page has a variable height due to dynamic content. Is it possible to use jQuery to find the height of the content container, and adjust the sidebar height to match it? I found a few jQuery plu...

Open new browser windows in JavaScript without making it active

I have some JavaScript that makes an AJAX call and, if the call fails, opens a new windows (tab in Firefox) and displays the response from the server in that window. This is very convenient for debugging, because the error is typically from Pylons, so it's a full HTML page. The only problem is that the new tab becomes the active tab, wh...

String.charCodeAt undefined?

I get this error in the javascript debug panel when trying to call String.charCodeAt('9') in Safari 3. TypeError: Result of expression 'String.charCodeAt' [undefined] is not a function. When I try to do stringInstance.charCodeAt('9') instead, I get NaN. Am I doing something wrong? I'd just like to get the char code for some cha...

Do something every 5 seconds and the code to stop it. (JQuery)

How can I repeat a function doSomething() every 5 seconds. I also need code that will make it stop doing it. And code to on-the-fly adjust the frequency. ...

Finding Parent form's button from frame in javascript

Hi, i cant get my main form's button from frame by javascript.I am getting button's ID by querystring then i execute following script but cant get button.When i write parameter's name such as getElementByID('btnDelete'),it founds control?What can be reason and how can i solve this problem? function okay() { var btn = g...

Javascript: namespacing

I'm currently using the following pattern to create namespaces and singleton objects in Javascript: var Namespace = function () { var priv = { privateVar1: '', privateVar2: '', privateFunction1: function () { //do stuff [...] }, [...] }; var pub = { pu...