Skip to content

Tag: javascript

Raphaël Object: Simulate click

It it possible to simulate an click on an Raphaël object? I tried already Answer Just access the DOM node using Element.node as described in the docs. You can then trigger events on the node as you would with any other DOM element http://jsfiddle.net/UFZXP/ http://lifescaler.com/2008/04/simulating-mouse-click…

check if number string contains decimal?

After doing a sqrt() How can I be check to see if the result contains only whole numbers or not? I was thinking Regex to check for a decimal – if it contains a decimal, that means it didn’t root evenly into whole numbers. Which would be enough info for me. but this code isnt working… I bet t…

Javascript array search and remove string?

I have: I want to be able to do something like: array.remove(“B”); but there is no remove function. How do I accomplish this? Answer I’m actually updating this thread with a more recent 1-line solution: The idea is basically to filter the array by selecting all elements different to the elem…

Set a default sort column in SlickGrid

I’m using SlickGrid with DataView and I’m trying to set a default sort column on my table. Is there a way to trigger the sort or set an option so the column is sorted on load? Answer On the latest version you could do this: You can also set multiple with setSortColumn*s*

javascript shifting issue (rgb and rgba to hex)

I found a RGB to hex converter and I’m trying to make a RGBA to hex converter. The original rgb2hex function works but the new rgba2hex function does not. What am I doing wrong? The rgba function is returning gba, no r. Example: Current output: ff9b2d and 9b2dff Expected output:ff9b2d and ff9b2dff Answe…