javascript

Javascript: how to map a var to a function under jquery? (Resolved)

Hi, I'm tweaking an existing open source tool... Its current js code has the following line, that opens up a new window to dump output, and the user takes an action or not. var win = window.open(...); What I'd like to do is to redirect the var win ... part so that it would send the {data} via a FORM element and let a web server scri...

jQuery UI position() not repositioning the element

I have a hyperlink which I am trying to reposition on the page using $('#myLink').position({ my: "center", at: "center", of: "#contentArea", offset: "30 130" }); However it's not being placed in the new position. My page is a complicated html so I can't post it. I tried different target elements but same results (both in IE8 & FF). I...

In Javascript, what is the motivation or advantage of using var foo = function foo(i) { ... } ?

I see that in the answer of http://stackoverflow.com/questions/3233582/in-javascript-why-write-var-querystringtohash-function-querystringtohash-qu which is doing something like var foo = function foo(param) { ... } in that particular case, why do that instead of just using function foo(param) { ... } ? What is the advan...

How do I find which JavaScript is changing an element's style?

I have an element that's getting styles applied via JavaScript. I'm not sure exactly where; is there a way to check Firebug to show where the "element.style" is actually coming from? ...

jQuery extension: why does it not work on all matching elements?

I have an extension going like: $.fn.crazything = function() { var self = $(this); // do some crazy stuff return self; } And when I call it like: $("div.crazydiv").crazything(); It works, but only on the first matching div. If I have more than one div on the page, I need to do: $("div.crazydiv").each(function(i) { $(th...

ExtJS listeners: anonymous function parameters

I grabbed this code form some book I've bumped on the InternetS... sm: new Ext.grid.RowSelectionModel({ singleSelect: true, listeners: { rowselect: { fn: function(sm,index,record) { Ext.Msg.alert('You Selected',record.data.title); } } } }); now, sm is shorthand for selection...

Periodically detecting specific strings inside of an HTML element

I have a div element with contenteditable set to true, and I want to detect whether a certain string exists within the element, and if so, style it, giving the appearance of syntax highlighting (I've already looked at existing libraries/scripts, and none of them work the way I need them to). What would be the best solution to this, whil...

jQuery Show/Hide Question

I'm just trying to preform a very simple jQuery action. I have two components: #safety and #safety-tab a, the #safety needs to be hidden on load. When the a link in the #safety-tab is clicked, it will hide itself and slideUp the #safety. This sort of works, but the #safety box just flickers on click, doesn't stay shown: $(document).r...

jquery slide out tab behind flash

on this site the slide out tab on the right slides behind the flash. any ideas on how to get it to slide over it? ...

Detaching/appending select options with jquery

I'm trying to set up a form with multiple dropdown lists, that will allow visitors to rank the list items. Sample form: <form action="" name="rankem"> <select name="rank1" id="rank1"> <option value="option1">Option 1</option> <option value="option2">Option 2</option> <option value="option3">Option 3</option> <option v...

Accessing <span> node in Javascript

I'm trying to write a greasemonkey script that only displays photos with the tags bacon. The site it runs on is written like so: <div class="photos"> <ul> ... <li> <a href="photo1"> <img src="http://somesite.co/photo1.jpg" </a> <br /> <a href="tags_photo1"> <span class="tags">&nbsp;bacon, delicious&nbsp;</span> </a> </li> ... </ul> </...

jQuery custom Accordion - not working in IE/ Safari / Chrome

My script should expand/collapse UL elements when a corresponding is clicked. It works in FF fine and can be viewed over here. I am loading jQuery lib first then my own examples.js which contains: function initExamples() { $('#examples ul').hide(); $('#examples ul:first').show(); $('#examples li a:first').addClass('exampleon'); ...

Does a browser download JS files if the user has JS disabled?

Does a browser download JS files if the user has JS disabled? I'm wondering if the browser downloads the JS files and ignores them or ignores the download all together. Do different browsers act differently in this case? Edit: I asked a follow up question to this question here. ...

Is it possible for a regex to know whether a date is a weekend or not?

Using javascript I need to validate a form field containing a date in the format: 21/04/2010. The date must be a weekday. Is it possible to create a regular expression for this or is there another, better way to do it? ...

jQuery Autocomplete isn't working inside the return function of a $.post call.

Basically, here's my code: $("#airway-bills").autocomplete(awbs, { mustMatch: true, autoFill: true }); $("#airway-bills").focus(); $("#selected-awbs").val(""); $("#origin, #destination").change(function() { var origin = $("#origin").val(); var destination = $("#destination").val(); var element = $(th...

Filling drop down list from database values in jsp using javascript(No ajax, no jquery)

I have an application where user can mention the transactions. The transaction must be mapped with some of the securities(Company name) that the user has already created. I want user to see the names of securities that he has created and as he starts typing, only the related securities must be visible. Eg. If user types a, then all sec...

Position fixed and width 100% element covering vertical scrollbar in IE

I have a div with WIDTH 100% and position fixed on the top of the page. It covers the vertical scrollbar in IE when vertical scrolling is needed on the html. What can I do to avoid this (I can't change the position fixed bit)? Can I detect whether page need vertical scrolling onload/resize and change that static div's width using jQuer...

targeting all elements in a div

right now i have this $(".container a").css("color","#ffffff"); which styles all links inside ".container" white. then i have a div structured like this <div class="container"> <div class="header"> <a href="> </div> </div> the links inside that second div only turn white in Firefox. Is there a way to fix the line of js with...

Why some professional web designers use absolute paths instead of relative paths (e.g for CSS, Javascript, images, etc.)?

I used to think that everyone used relative paths (e.g. /styles/style.css). But I wonder why some popuar web designers (e.g. http://www.getfinch.com and http://31three.com/) use absolute paths (http://example.com/styles/style.css). So basically I'm asking why some professional designers are using absolute paths instead of relative paths...

cloud drive vs. cloud files (or should we not bother?)

The web application is in the process of moving from a standalone server to a pair of servers behind a load-balancer, and contains a 50GB directory of user-created data that is growing rapidly. On rackspace, the only way to add disk space dynamically is by also doubling RAM and monthly cost, which isn't necessary. So, to cloud files it i...