javascript

jQuery UI object type for "ui" object passed to the callback function?

In jQuery UI, what is the type/contents of the "ui" object passed to the callback function of alot of the event methods, and how do I use it? For example, the "selectable" demo, the event "selected" gets passed two params. "Event" and "UI". I am trying to use it as follows: $("#selectable").selectable({ selected: function(ev...

How to dynamically create a fully functional gridview in javascript with the results returned from a script service.

Hi i need to create a fully funnctional gridview with the results returned from a script serice ( AJAX enabled WCF Service ). The grid should allow user to sort and page the data. could any body drive me to the proper technology or a useful link. thanking you, Ramana kumar. ...

javascript to find memory available.

Let me make immediately clear: this is not a question about memory leak! I have a page which allows the user to enter some data and a JavaScript to handle this data and produce a result. The JavaScript produces incremental outputs on a DIV, something like this: (function() { var newdiv = document.createElement("div"); newdiv.inner...

jQuery BlockUi Message after another

Hello, I'm using jQuery BlockUI plugin, and i have been able to sucessfully show a single message in the page, however... let's say that I want to show 3 messages , one after another. Something like: message: 'hello world!' message: 'hello galaxy!' message: 'hello universe!' how do I do this with jQuery BlockUI? ...

Why does JavaScript have such a confusing API?

I was wondering why JavaScript has such a confusing API. It is not consistent across browsers, there is a different way to get the value from each type of form input, and it is unforgiving of mistakes. jQuery has changed my life because its API is so much easier. Why did the creators of JavaScript not set up the API like that in the f...

Why do registered events disappear when an element is removed from DOM?

This jQuery 1.3.2 code adds an element to the page, registers a "click" event, then removes and reattaches the element: var button = $('<button>Click me!</button>') .click(function(){ alert("Hello") }) .appendTo('body'); $('body').html(''); button.appendTo('body'); The button appears on the page as expected, but clicking on it ...

Trail effect with jQuery ?

Can this be done ? Basically I want to animate an absolute-positioned image with right:xxxPX, let's say. Well, when the animation is in progress, can I add a "trail" effect to it? Thanks, Adrian ...

How to trigger script.onerror in Internet Explorer?

The onerror page on MSDN states that the onerror handler can be attached to a script element and that it "Fires when an error occurs during object loading.". For the purpose of unit tests, I am trying to get this onerror handler to fire, but could not find a suitable example. The following code triggers an error in Firefox, but no aler...

how to remove css property using javascript ?

is it possible to remove a CSS property of an element using JavaScript ? e.g. I have div.style.zoom = 1.2, now i want to remove the zoom property through JavaScript ? ...

javascript - how to convert unicode string to ascii

I need to convert unicode string to ascii to make a nice string for friendly url. Dont's ask me why dont do this in server side, please. ...

iphone sdk: How to get rid of the action sheet in UIWebView?

Hi guys I have a UIWebView and when I press a textual link (for at least a second) some kind of UIActionSheet appears with 3 buttons (open, copy and cancel) - Is there a way to prevent it from appearing? Thanks ...

How to check/calculate the week-day count (using Date functions) using Javascript?

Hi, I'm struggling with some javascript and date issues. I would like to check if a given date is the first, second, third, fourth or last monday, tuesday, wednesday,..., sunday in the dates month. The function should look like this: if(checkdate(date, "second", "monday")) { alert("This is the second monday of the month"); } else ...

Live editing in Django

Imagine you have an address book card. Normally the fields are displayed as static text, in a specific layout (imagine having multiple phone numbers, emails etc.). When editing it, you want to use the same layout, but with form fields instead of static text. It seems that the normal way of doing this in Django is to use separate views an...

How can I pass to Ruby obj to Javascript?

I have this to calling the choose_category: <% form_remote_tag :url => { :action => :choose_category, :id => category } do %> <%= submit_tag category.name%> <% end %> And I have this method to calling the choose_category.js.rjs: def choose_category begin category = Category.find(params[:id]) rescue ...

in execCommand, How can i know all the available para for the formatblock command?

I'm writting my own rich text editor in javascript formatBlock requires a tag-name string. I mean all the tag-name strings. ...

Debugging Markup/JavaScript with IE 8's developers tools

I'm working on a site and it is constantly failing with the following in IE8: Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917) Line: 0 Char: 0 Code: 0 What is the best way to troubleshoot this for IE8? IE7 compatibility mode does not solve the problem. Firefox gi...

How to I change the button into hypertext in RoR

Here is the code for generate button, but I want it in a hyper text, how to modify this? <% form_remote_tag (:url => { :action => :choose_category, :id => category }) do %> <%= submit_tag category.name %> <% end %> I tried to use the link_to, but it can't submit a post method, what can I do? ...

qUnit Teardown method

Is it possible to have teardown methods that run after every test in qUnit? If not, are there any plugins around that will do this? ...

Finding all elements within a region

If i want to find all elements that are inside a box region, what is the best way to do it as a Firefox extension? If i check all leave elements and call getBoundingClientRect(), it'd be too slow given that there can easily be more than 500 leaves on a page. Any help will be appreciated. Thanks. ...

zoom out using javascript css

for zooming I am using el.style.zoom = 1.5; el.style.WebkitTransform = 'scale(1.5)'; here e1 will be , I use webkit based browsers. Now how do I zoom back to original size ? Confused bec document says for zoom out have to use less than 1, and how to scale back to original size in webkit ? ...