closest

how to dispatch network requests to the (geographically) closest server

I'm a Java coder and not very familiar with how networks work (other than basic UDP/TCP connections) Say I have servers running on machines in the US, Asia, Latin America and Europe. When a user requests a service, I want their request to go to the server closest to them. Is it possible for me to have one address: mycompany.com, and s...

jquery closest() selecting

I am having issues getting my remove element function working. I have this function: //Remove an Item From Any Group function deleteItem (selector) { $(selector).closest("li").fadeOut(500, function() { $(selector).closest("li").remove(); }); } Then this to call it, $("a.delete").live('click', function() { deleteIt...

Using the Jquery closest() function?

Hi guys, Currently got this JQuery code... $(document).ready(function(){ $(".r3c").hide(); $('.show_r3c').click(function() { $(this).closest('.r3c').toggle(); return false; }); }); And here's my HTML: <tr> <td class="show_r3c">click here</td> </tr> <tr class="r3c"> <td>This is what I'd like to display</td> </tr> F...

jQuery $.closest() (Or whichever comes first)

While working a project tonight, I ended up using one .js resource file for two different pages. One page contains a textarea within a div, and another contains a textarea within a td. Wanting to work with the siblings of this textarea, and other children of its parent, I wondered how you could best implement "closest div or td, whicheve...

JQuery how to access divs <p> tag and append it

Hello I'm trying something .. I was reading Jquery traversing documentations some forums, this websites previously asked questions relating this topic .. none actually answers my question so I'll ask instead .. here is the deal <div class="entry"> week <span>some text</span> <p>DKK</p> <input type="radio" name="red<% Response.Write(co...

jQuery closest ID to my list

Hi Folks Hope you can advise, I'm trying to find the closest or a parent id. I think its maybe easier to show you. Here is some example code. <li id="search" class="widget color-green"> <div class="widget-head"></div> <div class="edit-box" style=""> <li class="item"> <label>Available colors:</label> <ul class="...

traversing td/tr with jquery's closest()

<td width="162"><span class="required">*</span> Name:</td> <td width="407"> <label> <input id="store_name" class="text_field alnum" type="text" minlength="3" maxlength="30" size="40" name="store_name" style="color: rgb(51, 51, 51);"/> </label> </td> <td class="char_count_area" style="color: green;"/> I have some...

Dynamic closest elements

Hi, I have a 2D surface ( Grid ) with 50 elements at different locations. I need to decide which are the 10 closest elements to a given point. In addition, the given point is constantly moving and i need to do the calculation on each movement. I know I can calculate the Euclidean distance to each point on each movement, but I want a f...

jQuery closest();

Hi There! I'm trying to animate an image which is partly hidden (via overflow: hidden) inside a list item. I want this to happen when a user hovers over an A tag inside the same list item. I have the following markup: <div id="projects" class="section"> <ul> <li> <img src="assets/img/projects/pf6.jpg" width="980" height="5...

jQuery: How to get the closest value when a button is clicked?

I can't seem to get this code to work. How do I get the closest value of .abc when the button is clicked? Defining Closest ie: if you click the button where "A:" is at I want a value of 10. if you click the button listed in "B:" I want the value of 20. Here is the code: <script type="text/javascript"> $(function(){ $('.test').click...

Fastest way to find the closest point to a given point in 3D, in Python.

So lets say I have 10,000 points in A and 10,000 points in B and want to find out the closest point in A for every B point. Currently, I simply loop through every point in B and A to find which one is closest in distance. ie. B = [(.5, 1, 1), (1, .1, 1), (1, 1, .2)] A = [(1, 1, .3), (1, 0, 1), (.4, 1, 1)] C = {} for bp in B: closest...

Mysql Algorithm for Determining Closest Colour Match

I'm attempting to create a true mosaic application. At the moment I have one mosaic image, ie the one the mosaic is based on and about 4000 images from my iPhoto library that act as the image library. I have already done my research and analysed the mosaic image. I've converted it into 64x64 slices each of 8 pixels. I've calculated the a...

Jquery Closest From Element Value

Hey All Im trying to get a form element value using closest. Here some example code. <table> <tr> <td>Hour <input type="input" value="12" name="data[hour]" class="hour" /></td> <td>Minute <input type="input" value="12" name="data[minute]" class="minute" /></td> <td><a href="#" class="add-data">Add Row</a></td> </tr> </t...

Solving a cubic to find nearest point on a curve to a point...

Ok, I have a projectile that has its position defined such that: a.x = initialX + initialDX * time; a.y = initialY + initialDY * time + 0.5 * gravtiy * time^2; I want to be able to predict which obstacles in my environment this projectile will collide with. I plan on checking the distance from A the closest point on the curve to th...

jQuery closest TR selection

Hope someone can advise. Having issues trying to remove a row once a link has been clicked. HTML <table> <tr><td>Some Data</td><td><a href="#" class="remove-row>Remove Row</a></td></tr> <tr><td>Some Data</td><td><a href="#" class="remove-row">Remove Row</a></td></tr> </table> Now the JS $("a.remove-row").live('click', function(...

using jquery, how would i find the closest match in an array, to a specified number

using jquery, how would i find the closest match in an array, to a specified number For example, you've got an array like this: 1, 3, 8, 10, 13, ... What number is closest to 4? 4 would return 3 2 would return 3 5 would return 3 6 would return 8 ive seen this done in many different languages, but not in jquery, is this possible to d...

How to get value of nearest input Jquery

I have multiple buttons on my page with the same class. When I click on a button I want to get the value of the nearest input box (remember there are multiple input boxes and buttons on my page with the same classes). I have: $(".deletepostbutton").click(function() { var deleteid = $(this).closest('.deleteid').attr('va...

C#: How to detect which textbox value is equal to, or the closest to zero of a group of textboxes/values?

I have a great excel formula I have been using but I want to distribute something a little more substantial and durable and also user friendly to my group of designers at work. I am also dealing with negative numbers unfortunately so going by the minimum value would not work. So if textbox1 said 13, textbox2 said 4, and textbox3 said -...

jQuery - parent() not working within callback function

I was testing with parent() and closest(), none work within function. TD stays the same, no change using this method: $.get('form.php', function(data){ alert(data); $(this).closest('td').html('Done!'); }); TD gets updated, this method works: $.get('form.php', function(data){ alert(data); }); $(this).closest('td').h...

What's wrong with my usage of closest()?

I have a set of nested DIV's and I need to find each outer box from the inner box. According to jQuery API, the closest() method gets the first ancestor element that matches the selector. So I've tried this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; <html> <head><title></ti...