javascript

Trouble with Using Value of a Variable

I am quite new to Javascript. I am trying to use the ajaxupload plugin to make an upload work within a form. I figured out how to use the form with the file upload plugin. Now, however the output of the form field just appears as [object Object]. Here's the code var text=$('input#text').val(); onSubmit: function(file, ext){ ...

Infinite loop triggered by absence of alert()

For reasons entirely beyond my comprehension, this function runs just fine: function foo() { var loop = true; var abc = ["a","b","c"]; var ctr = 0; while(loop) { $("<img />").error(function () { loop = false; }).attr('src','images/letters/'+abc[1]+(ctr++)+".jpg"); alert(ctr); } } ...

Are there any Ajax/jQuery like library for Windows mobile application development?

Hi, I need to develop an ajax based interface for a web-page, and I am not able to find any library that can help me do it. I have tried jQtouch, and it doesn't seem to work for windows mobile. Also I have tried XUI Library (http://xuijs.com/), this also didn't work. Can anyone point me to the right direction? I don't like to do ajax ...

Help For A Simple Regular Expression

Hi, i want to extract 34 from this string. How Can i done that ? (i will use javascript) #project_maincategory=3&project_subcategory=34&project_tags[]=70&project_tags[]=71&created_in=30 ...

Check ASP.NET MVC values (roles) from client (jQuery)

I have an MVC app that is basically one page with a bunch of AJAX calls that parse returned JSON and then using jQuery will populate the page. So, for example, if I call /API/Users/List it will return some JSON and then I'll parse that and dynamically create an li element for each user. Then, I put an edit link next to each user name a...

Get anchor tag text using javascript

I don't know if it is possible! Maybe my thought is also wrong. I want to invoke a search corresponding to all links in my Wordpress blog. I am using an Ajax call for my other search in this site. How can I retrieve a linking text from hypertext tag in html. eg: <a href='www.example.com'>demo</a>.here i want to get 'demo' as input. ...

Is there a way to detect when a visitor comes back to your page after opening a new window?

Is there a way, using JavaScript or jQuery, to detect when someone goes back to your page after opening a new window or tab? I want to create a script that opens a new window or tab, and then does something when the user comes back to the page. Thanks, ...

how can i assign value to a Html.Hiddenfor from a jquery/ javascript

I have a hidden asp.net MVC control in the form: <%= Html.HiddenFor(m => m.NodeId) %> my JavaScript / jQuery code: var DeleteEntireItem = '<% = btnDeleteEntireMenu.ClientID%>'; var Node; debugger; $('#' + DeleteEntireItem).click(function () { Node = NodeValue; document.forms[0].submit(); }); How can I assign the value of v...

Send only few properties of objects within an Array in ajax call with jQuery

// Initialize the object, before adding data to it. var NewPerson = new Object(); NewPerson.FirstName = $("#FirstName").val(); NewPerson.LastName = $("#LastName").val(); NewPerson.Address = $("#Address").val(); NewPerson.City = $("#City").val(); NewPerson.State = $("#State").val(); NewPerson.Zip = $("#Zip").val(); In actual I'm p...

Circular Carousel (jQuery)

I'm using a lightweight jQuery plugin for carousel, it works great except that it doesn't support circular carousel, i.e it'll auto-slide 1,2,3,4 and then backwards 4,3,2,1 instead of 1,2,3,4 then again jumping back to 1,2,3,4 again, which is what I want. Here's the jsFiddle for it: http://jsfiddle.net/vLZFh/ I'd really appreciate any...

jQuery: set 'active' class in menu from secondary link

Hi, I have a standard css/jquery menu where I use addClass/removeClass to set whatever li I am on to 'current'. However, the code to do this uses $(this). I want to also do this same set of procedures from links not in the menu. For example, I would like the menu 'active' flag to be in the right place after following a page link that is...

Update 2nd Textbox Based On Popup Calendar Selection

I am using the JavaScript-based popup calendar from dynamic drive named "Xin's Popup Calendar" and it works perfectly. But, I want to be able to adjust the date of a 2nd textbox based on the selection. For example, I want to be able to automatically adjust it to +1 month of whatever date was selected in the popup. How can I do that? H...

Read out JavaScript onClick function body and use it for another onClick

Hello, I try to copy an onClick function from an image to an span object. But I don't get it. I have tried it directly with onClick=img.onClick, onClick=new Function(img.onClick) and more. if (img.onclick != undefined) { var imgClick = img.onclick; strNewHTML = strNewHTML + " onMouseOver=\"this.style.background" + "= '#cec...

How to disable google translate original text tooltips

I have used google translate as a language converter in my site but it displays annoying tool tips called 'Original text'. How do I disable this and any other better ideas/tools/apis to do this? Thanks. The code used is... <div id="google_translate_element"></div><script> function googleTranslateElementInit() { new google.translate.T...

Using jQuery how to get click coordinates on the target element

I have the following event handler for my html element jQuery("#seek-bar").click(function(e){ var x = e.pageX - e.target.offsetLeft; alert(x); }); I need to find the position of the mouse on the #seek-bar at the time of clicking. I would have thought the above code should work, but it gives incorrect result ...

Table border affecting cell size

Can anyone tell me why when I place border=1 on a table is fixes its layout? This is the problem: I wrote some JavaScript that makes me an org chart. If I place a border around the tables that make the chart, everything lines up perfectly. If I remove the borders, some of the lines vary wildly (and seemingly randomly) in width. You will...

Wanting to mix server side ASP.Net MVC expansion in javascript file, but how... RenderPartial?

Hi, I have some common javascript functionality that I want to share across several views/pages. However I want to put some C#/ASP.net into the javascript - pulling in some data from the server. It seems like the best option is to use a partial page, and include the javascript in that. Just wondering if there is a javascript equivale...

Capturing Adobe Air keyboard events in new window

This is sufficiently important to me that I'm opening the question up to a bounty with a simple goal: Can anyone successfully open a new, full-screen NativeWindow in AJAX Air and, from that window, detect key strokes? Hopefully I'm just overlooking something really, really simple, but if JS is not capable of listening for keyboard even...

last element of array in javascript

Its kinda weird Javascript Array class does not offer last method to retrieve the last element of array. I know the solution is too simple (Ar[Ar.length-1] ) but still this is too frequently used. Any serious reasons why this is not incorporated yet? ...

Cannot get declared variables in javascript

Hello, Consider a javascript file script.js which contains the code alert(theVar); Now, i linked the js file to the document like <script type="text/javascript"> var theVar= 'a alert'; </script> <script type="text/javascript" src="script.js"></script> //Contains alert(theVar); The variable theVar is used and i get a alert. This ...