javascript

click and drag not working on iphone

Check the url http://bit.ly/bN6EFH Its working fine in all browsers but when i run this in iphone safari, it does not work correctly. Its just a javascript code that finds click and drag event. Using click n drag i am changing images. Please click n drag images. I need some special code for making this work in iphone safari? ...

Displaying confirmation page before submitting a form

Within a Cake application, if a user is submitting a form to edit a record, what do you think would be the best way to outline the specific changes made? I would like to display the values to all of the fields that the user is changing and offer them the option to either confirm the changes or go back and change them. I assume that it wi...

div ,get css attributes from java script

hey there i want to change some css attributes from javascript but i cant access css values for that div here is what i have in my css file #sidebar { float: left; width: 160px; padding: 25px 10px 0 20px; } #sidebar ul { margin: 0; padding: 0; list-style: none; } here is my html code for that div <div id="sidebar"> <%@ incl...

jQuery script supposed to run async but works only sync? why?

I have this small jquery script that does not work if I remove the 'async:false' part... And I don't understand why (the alert() part is there just to check if it works or not). My guess was it would work asynchronously but it just doesn't. Can somebody explain to me why? And what should I change to make it async? $(document).ready(func...

Javascript / jQuery design question re: performance

Is there any performance / memory hit differential among the three following styles? Exhibit A: var func = function() { // do some magic } $("#div").somePlugin({someEvent: func}); Exhibit B: $("#div").somePlugin({someEvent: function() { // do some magic }); Exhibit C: function func() { // do some magic } $("#div").s...

connection beetwen html, js and cocoa by webkit

hi. i have cocoa app with embed webkit, which show simple html with <input id="first_name" type="text"> and <input id="start" type="button"> and i want this: when you click #start button, show up a regular cocoa NSAlert with #first_name value. Well, i need to somehow organize a connection between html,js and cocoa. it it possible? ...

prototype selector equivalent to jQuery

Hi! How can I select the popupwindow of the popup-lightbox div? in jQuery, it's be something like $('div#popup-lightbox #popupwindow'). Unfortunatly, in Prototype, it's not that easy... anyone can help me? thanks! <div id="popup-lightbox" class="popup"> <div id="popupoverlay"></div> <div id="popupdiv"> <div id="popupwi...

Difference between Date(dateString) and new Date(dateString)

I have some code that tries to parse a date string. When I do alert(Date("2010-08-17 12:09:36")); It properly parses the date and everything works fine but I can't call the methods associated with Date, like getMonth(). When I try: var temp = new Date("2010-08-17 12:09:36"); alert(temp); I get an "invalid date" error. Any ideas on...

Javascript/Jquery Single event target delegation

Dear experts, I realized event.target redundancy could cause a lot of problems in the future when they are binded with another event in the next level. For example, when i have an Div element inside another. <div id='div1'> <div id='div2> </div> </div> I use the follow Jquery code to bind an event. $('div').bind('click', func...

How do i create a drop down like menu similar to the Facebook drop down notifications

I am planning to create a drop down menu for my site similar to the DB drop down for notifications Any JS library help will be appreciated ...

Does anyone know a good marquee/horizontally scrolling ticker for JQuery?

One that is identical to Twitter.com's horizontal scroller is perfect. ...

Javascript library for adding comments

Hi! If somebody know any js library for commenting text like in http://picbite.com for images ? Thank you! ...

Javascript: trap focus in dialog

I have a popup dialog (a div with a high z-index) which contains some input elements. While this dialog is open, I'd like tab and shift-tab to only cycle between elements in this dialog. How can I accomplish this? ...

Can't block keys using event listener

<body id="body" runat="server" onkeydown="return showKeyCode(event)"> Now whenever I hit a key, IE8 (or in comp mode) throws an exception directing to a problem in line x, which happens to be my body tag. How can I prevent that ? The JS code to my knowledge should be with IE comp. (works in Chrome) Moreover the code doesn't work in IE ...

Edit HTML with returned jQuery html() content

I want to edit some HTML I get from a var I saved. like: var testhtml = $('.agenda-rename').html(); console.log($('input',testhtml).attr('name')); Also tried console.log($(testhtml).find('input').attr('name')); But i get undefined? I figured it'd work like an $.ajax, $.get, $.post? How else can i do it? ...

Google Maps map.getBounds() immediately after a call to map.fitBounds

I'm calling getBounds() directly after a call to fitBounds(), and I thought I'd get a valid bound back as the map recenters and zooms to fit the bounds. Unfortunately, getBounds() is returning nil. The code to reproduce this is as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-...

How to reset the style properties to their CSS defaults in javascript?

On a php generated page there are several elements like this: <td class="defaultTDStyle" style="color:userDefinedCustomColor" id="myTDId"></td> So there is a default style and I apply several extra styles that override the style defined in the CSS. Is there a way to remove these added styles from javascript? It seems the obj.style.co...

Replacing characters with jquery

Hi all, thanks in advance for your help. I'm using this piece of code to replace a circumflex a that keeps appearing in a website I'm working on, however it only replaces the first occurance of the circumflex a in a given tag. Can anyone help me extend the code? $(function() { $('h2, h3, h4, p, a, div, body').each(function() ...

Get the current <li> number

Hi I have a list like this one: <ul> <li> <a href="..."> ... </a> <a href="..."> ... </a> </li> <li> <a href="..."> ... </a> <a href="..."> ... </a> </li> <li> <a href="..."> ... </a> <a href="..."> ... </a> </li> ... </ul> and the jQuery: $("li").each(function(){ // do stuff }); How...

designMode or contentEditable on mobile safari

I'm trying to make an iframe editable in mobile safari. Works fine in all browsers (including safari) with both contentEditable and designMode=on, but on mobile safari i can't get any of them working. Is there a way to make it work on mobile safari? ...