javascript

add event to top of event stack using jquery

I'm using jquery to add a blur event to a text box. I would like my event to fire before any other existing events. Is this possible to do? ...

Google maps sometimes does not return a geocoded value for string

Hi Guys, I have the following code: It basically looks into a HTML list and geocodes and marks each item. it does it correctly 8 out of ten but sometimes I get an error I set for show in the console. I can't think of anything. Any thoughts is much appreciated. $(function () { var map = null; var geocoder = null; function initialize(...

SVG - From Window coordinates to ViewBox coordinates

Hi, Basically I have an svg "SecondSVG" into an svg "FirstSVG" into an svg "MainSVG".Every svg has its own ViewBox. This page can be loaded anywhere on the screen by another page. So basically how can i find the screen x for viewBox for"SecondSVG" knowing that this svg can be loaded basically anywhere based on the calling page? event.cl...

Posting New html from TINYMCE

Seems like a simple problem, I have a form and when someone needs to edit data, the textarea that is controlled by TINYMCE loads the values, but when I change it and submit the form, the new changes are not being posted. What am I doing wrong? UPDATE How do I do it via this, or do it say on click in the editor. I am using jquery valid...

How to pass a parameter to jQuery UI dialog event handler?

I am currently trying to hook up jQuery UI dialog so that I may use it to create new items to my page and to modify ones existing already on the page. I managed in the former. I'm currently struggling in the latter problem, however. I just cannot find a nice way to pass the item to modify to the dialog. Here's some code to illustrate th...

How to creat a simple slider for div contents?

What is the simplist way to create a simple slider for a div? ...

mootools add an id

Is there a method like toggleClass() for and ID in mootools? ...

What's a good plugin or guide I can use to create javascript widgets from a Rails App?

I've been looking around for a while now and the best guide I've seen so far is Dr Nic's DIY widgets how to (here). I haven't been able to make something like this work: Assuming this is my widget code: <script src="http://mysite/nomnoms.js"&gt; </script> And my nomnoms controller looks like (assume that the list partial exists and...

Javascript get image src: FF shows escaped chars, IE doesn't

If I set: <img src="test-àè" onclick="alert(this.src);"> on FF the alert shows an escaped message: test-%C3%A0 while on IE it shows the unescaped version: test-àè I'm using: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; in my page and windows-1252 encoding <meta http-equ...

JavaScript: how to remove line that contain specific string

hi, how can i remove a complete line if it's contain specific string like #RemoveMe thanks in advance ...

javascript really strange behaviour

I have the following code if (msg.position == 0) //removed for brevity else if (msg.position == txtArea.value.length) //removed for brevity else { //ERROR: should not reach here. errorDivTag.innerHTML += msg.position + " " + txtArea.value.length; } I'm having some really weird situations where I'm getting the error in ...

jquery anonymous function declaration meanings

Are the following assumptions accurate? 1) execute immediately (function(){ })(); 2) execute on document ready $(document).ready(function(){ }); 3) shorthand for on document ready $(function(){ }); 4) alternative shorthand for on document ready for avoiding cross script conflicts (function($) { })(jQuery); ...

Check on every page to ensure user has validated as being over 18

Hi Guys and Girls. I'm working on a website (tobacco related) that requires all visitors to validate they are over 18 before they can view the site. I have a form in place that validates the age but I'm at a dead end. How can I use this to store a cookie that they've passed the test and do a check on all pages to see if this check has al...

Methods for breaking up content client-side into multiple "pages"

I have a long HTML text-only article formatted with paragraph tags. What I'd like to do is break this content into N number of divs so that I can create individual pages. So, for instance, on an iPad/iPhone, instead of reading one long page the user could swipe right/left to navigate to pages. My initial javascript attempts have been s...

what is this facebook code?

Inspecting what facebook is doing in my navigator, I see this code: for (;;);{"t":"refresh"} If you try to evaluate it, you can figure what happens (infinite loop). Do you Know what it is? ...

How to make a php page and use a Wordpress theme

hello I want to create a special php and javascript page, but I want it to use my Wordpress theme that is already installed. How to do that? Thanks ...

How to get the selected value from ajax.net ComboBox through javascript

Hello everyone, I need to get the selected value from an ajax.net combobox throught javascript so that I can do some client side validation. What's the best way to do this? Thanks, I've been able to get the value with this: var combo = $get('ddlComarcas'); var comboHidden = $get('ddlComarcas_HiddenField'); var o4 = combo.getElements...

JavaScript cookie value can't be retrieved in Django

I am trying to build a web site in both English and Bulgarian using the Django framework. My idea is the user should click on a button, the page will reload and the language will be changed. This is how I am trying to do it: In my html I hava a the button tag <button id='btn' onclick="changeLanguage();" type="button"> ... </button> An ...

Javascript form validation only works in firefox

Hello, I am relatively new to Javascript so I'm hoping this is a simple mistake. I building a generic form validation function that is called on the form's onSubmit. The function loops through all the form's child elements, looks for certain classes, and analyzes the contents of the appropriate fields. If it finds something missing or er...

how to prevent text selection when dragging mouse in Firefox?

I am wondering how those drag and drop widgets cancel text selection in the dragging element and other elements in the page. I tried the following code which works in IE8 (cannot select text) but does not work (can still select text) in Firefox. <!DOCTYPE html> <html> <body> <p>Hello World</p> <script type="text/javascript"> doc...