javascript-events

Check for comma in textbox using jQuery

How to check for a comma in a text box. I.e. if comma is present the code should alert, <input type="text" id="name"/> Thanks.. ...

Event to listen to attribute changes

I dont think this is possible but maybe someone knows a way to achieve this. I want to attach an event to an html element to listen to attribute change. So say for instance that I want something to happen when a visibility of a div changes. The reason is that I have no control over the javascript that is switching the visibility, hence t...

Get notified when objective-c dom updates are ready initiated from webview

I am programmatically updating the DOM on a WebKit webview via DOMElement objects - for complex UI, there is usually a javascript component to any element that I add. This begs the need to be notified when the updates complete -- is there any such event? I know regular divs dont fire an onload or onready event, correct? The other assumpt...

how to code client-side call to webservice that calls automatically every few seconds

I have a webservice that I want to call from the browser every few seconds to see if there are any notification messages in the database that should be displayed on the screen. We have the JSON code working to display the messages in a JavaScript function after an Async Postback, but this only executes after a page turn. I want it to exe...

Alert is showing two times. how to restrict?

<script language="Javascript"> function test(myObject, flag) { if ( (flag) || ((event.keyCode == 59) || (event.which == 59)) || ((event.keyCode == 44) || (event.which == 44))) {alert(myObject.value);} } function closeWin() {self.close();} </script> <form name='test'> <textarea name='textareaName' co...

how to hook up default beforeunload event on an aspx page ?

I have a custom web part placed on one of the application page in SharePoint. This page it seems already have a function which gets executed on windows beforeunload javascript event. My problem is that i too need to execute some client side code (to prompt user for any unsaved changes in my web part) on windows beforeunload event. Ho...

Results page in other window.

I have this simple form: <form method="post" action"."> <input type="text" name="title"> <input type="submit" name"send"> </form> I want that when a user click on submit, then will be open another window of browser with the results. Is it possible ? ...

Javascript Class using the window.onunload event

Hi All, I have a javascript class with methods and properties. Is it possible to wire this class up to a pageunload event? I am trying to call a method in my class when the user moves pages. How can I do this. Thanks ...

Android browser javascript events when minimised

I'm building a webapp for Android smartphones that runs with the OS internet browser. the main interface is to input datas. the data is added to a queue (android 1.5: gears, android 2.x: html5). Each 5 minutes (using setTimeout), the script looks if an internet connection is active, and if so, sends all the queue to the server. If the p...

attach event to sharepoint multiline textbox having text type "Enhance Rich Text"

Hi All, I have to attach OnKeyPress event to the SharePoint multiline column with text type as "Enhance Rich Text". Following is the jscript code that I am using <script> var ele=document.getElementById(inpID); if(ele!=null){ ele.onkeypress=function(){calLen(this);}; } function calLen(obj) { if(obj.value.lengt...

onHide() type event in jQuery

Does anyone know of an onHide() event or something similar in jQuery? I tried: $(this).bind('hide', function(){ console.log('asdasda') }) But apparently that doesn't work. Edit: Just to clarify, it's being hidden using CSS display:none. I'm aware of the callback function but as I'm not hiding it (the CSS is) I can't use it....

Why is the event object different coming from jquery bind vs. addEventListener

Why is it when I use the jQuery bind the event object I get back is different from the event object I get back using addEventListener? The event object resulting from this jQuery bind does not have the targetTouches array (among other things) but the event from the addEventListener does. Is it me or is something not right here? $(docu...

Javascript detect event handlers available on HTML element

Is there a way to detect what event handlers are available natively for an HTML element? For example: isAvailable(img.onload) === true; // All browsers isAvailable(script.onload) === true; // Non-IE only (Webkit, Firefox, Opera) isAvailable(link.onload) === true; // IE (and I think Opera) only Ideally I want to do feature detect...

jQuery conflict with body onload event

I have a strange conflict in my code. I have a function that called from body onload: var someGlobalVar=new SpecialType(); function OnBodyLoad() { someGlobalVar.Bind(); } But when I include jQuery 1.4.2 in my project I get an error that someGlobalVar is undefined. Why is the global variable undefined now, and what ways are there t...

Javascript Event Bubbling Not Working As Expected

Hi Guys, Having a nightmare trying to figure out event Bubbling.. Full test case: <html> <head> <script type="text/javascript"> function $(ob) { return document.getElementById(ob) } function bodyClick() { $('win_clicks').value = parseInt($('win_clicks').value) + 1; } window.addEventListener('load',function(e) { $('bl_lnk').ad...

Finding parent class and id

Well after countless tries i can't get this work? <script type="text/javascript"> $("td input").focusout(function() { var column = $(this).parent('td').attr('class'); var row = $(this).parent('tr').attr('id'); $('#dat').HTML(row+" "+column); }); </script> And the html looks like this <tr class="numbers" id=...

HTML5 video currentTime and buffering

Hello, I have a buffering issue. On my page (which I access remotely), I have a video that I position using the currentTime attribute. However, it seems like, despite the fact that I do not autbuffer, the video is still buffered until this position. Is that correct ? Is there a way I can seek to this position without reading the video ...

Why is post() not updating the DOM after it returns? Wierd timing problem observed.

Hi all, I have the following code that is really bugging me, I'm thinking perhaps the post() function needs to be blocking. I am new to jQuery(latest version) and AJAX, but I'm using ColdFusion which returns some HTML in the data variable. var dataResult; var statusResult; $.post('fh_result.cfm',$('#myform').serialize(),function(data,...

Detecting support for a given JavaScript event?

I'm interested in using the JavaScript hashchange event to monitor changes in the URL's fragment identifier. I'm aware of Really Simple History and the jQuery plugins for this. However, I've reached the conclusion that in my particular project it's not really worth the added overhead of another JS file. What I would like to do instead...

fire link onclick events and follow href from javascript

I have a page defining a link ('a' tag) and some onclick events associated with it. I am trying to add an arbitrary HTML element (in this case a div) with the ability to respond to click events by firing the click events of the link. The code below describes all that. The end goal is to trigger exactly the same actions whether the cli...