jquery

Jquery Autocomplete with JSON beginners question

I am using the official Jquery Autocomplete plugin. I have an ODBC database with a list of advertisers. I currently have an input box where the user types in part of the name and I am successfully returning a list of partial matches. The problem I'm having is I do not understand how to return both the name and the ID of the advertiser...

JQuery $.getJSON runs the first time, then never again

I have a button click function that is to run a $.getJSON when the button is clicked. It gets some values from a controller posts those to some form fields and opens a modal that contains the form. The first time I click the button it runs the $.getJSON posts the values and opens the modal just fine. when i close the modal and click th...

jQuery.replaceWith() on input field and regaining focus in IE

There is a script http://gist.github.com/457324 that sets default text (taken from element's title attribute) for empty input[type=text] and input[type=password] elements. For password elements it is not that trivial though. If I did $(this).attr('value', $(this).attr('title')); for input[type=password] it would just show dots instead...

How can I parse this particular JSON data from LastFM using jQuery?

I'm attempting to parse a JSON feed using the LastFM API but there are certain elements returned in the JSON array that are prefixed with a # that I don't know how to reference. The feed URL is here and it can be seen visualised here. My jQuery code so far looks like this: $.getJSON('http://ws.audioscrobbler.com/2.0/?method=geo.geteve...

How to exit from $.each function when condition met

How can I exit from $.each loop when a condition is met? I don't want to iterate the collection further. $(vehicles).each(function() { if (this["@id"] === vehicleId[0]) { vehicle = this; } }); I tried with break; & return; statement but it looks the execution doesn't not stop at that point. Any idea would be greatly appr...

Grails Indexed Properties with No Real Index

Grails 1.3.1 I am using a jQuery library that sends a serialized parameter map to the server and it is formatted like so.... item[]=1&item[]=2&item[]=3 In my controller, when I do println params, it comes out... [item[]: [1, 2, 3]] I can't seem to get this data out of params in my controller, however. What am I missing? ...

Binding event to text node

Here's my HTML. I need to bind a click event to "someText" <div id="container"> someText <a href="#">A link</a> </div> "someText" could be any string of text ...

Jquery - Can I place my jquery code in a script at the end of the html body?

Will the DOM definitely be ready if I place my jquery code right before the </body> tag? I have some jquery code and when I put it in the $.ready() function I can see a flash of what the page looks like before the javascript code is run. However, if I put the code right before the </body> tag then I only see what the page looks like ...

Click events in a jQuery Dialog occur twice?

Hello, I have been dealing with an odd problem that .click() events happen twice whenever placed in a jQuery Dialog. My simple test case is below and a live example is here <div id="popup" style="display: none"> <a href="javascript:void(0);" id="testlink">Test Link</a> <script type="text/javascript"> $('#testlink').cli...

Applying test classes to dynamic page elements with jQuery

Hi, I am working with a tester who is using Selenium in my latest project. I was trying to get some information out of him as to how i needed to name my CSS classes applied to the dynamic elements on the page that he will be testing. I think he is rather new to this himself so was going to put our findings here for comment: Testing ...

Jquery: When adding submit button, it cannot be selected again.

Hello there, I would like to add a button to the current page using html()-function. This button needs to be selectable, and alert('click') when it is clicked. This seems impossible. Look at this code <script type="text/javascript"> $(document).ready(function(){ $('a').click(function(event){ $('div').html('<form method="p...

CSS Change in multiple locations on hover (jquery solution needed)

Hello, I'm working in wordpress, trying to figure out how to change the css color of a side nav element when a remote image is hovered. I would have done this easily with CSS and just assign the CSS hover class for each item, but since this is a CMS, the navigation and the image gallery will change dynamically. So, I'm looking for a J...

Jquery validate: errorPlacement not updating DOM until blur event

I've got a custom errorPlacement function that is updating a seperate message container with a custom way of displaying error messages. As part of the form I'm validating, I have a fair number of input text boxes to validate (think lines of numbers being checked against some kind of result), and as part of this need the error messages t...

AJAX + SEO quick question

When users want effects to happen between page loads (ie, old content fades out then new content back in), I typically build the site as follows: index.php, about.php, etc... <?php if(@$_SERVER['HTTP_X_REQUESTED_WITH']==''){include('includes/header.php');}?> <content>blah blah blah</content> <?php if(@$_SERVER['HTTP_X_REQUESTED_WITH']=...

Use jQuery .trigger to call a custom function that returns a value

Is there any way using jQuery's .bind() and .trigger() calls to execute a user defined function (ex: save ()) and act upon the return from the method? For example: $("#aForm").bind ('save', function () { return true; }); and then: if ($("#aForm").trigger ('save') == true) { doSomething (); } ...

Add captions to looped slider plugin?

Hello, I am implementing the looped slider plugin (see: http://nathansearles.com/loopedslider/example-4.html) on a website, and need to add captions to the images (that just appear as text beneath their corresponding images). Could anyone point me in a direction of where I could start? There is already so much jquery going on in this ...

jQuery mutually exclusive lists, with one being sortable.

I'm trying to build a website that has one set of staff in the database, and multiple departments. Each staff member may be part of multiple departments. The back-end code is fine with a many-many setup like so: `staff` `depts` | id | name | | id | name | | 1 | Alice | | 1 | Legal | | 2 | Bob ...

dynamically generated html doesn't wrap to the screen.

I cannot for the life of me figure out why this markup is not wrapping. There's nothing special about it, except that it is generated by javascript. Here's the code. Any thoughts on why it's messing up would be welcome. I can include the js if you need. but basically it reads the text in the textarea, extracts the words, and creates a l...

Why am I getting "undefined" with jquery.val()?

Goal: read in the current value of a set of text boxes. if the value is "None" replace the value with the value provided. Once a value is changed stop. When I use span and .text() instead of a textbox and .val() everything works. However, the textboxes are part of a form. Any idea why it would return as "undefined"? (basically i'm ma...

Showing both MVC Ajax calls and jQuery Ajax calls with one indicator

Hi All, I have a web application that utilises both the MVC Ajax calls: Html.ActionLink() rendering as Sys.Mvc.AsyncForm.handleClick( in the page source and: jQuery Ajax calls, eg: $.post() Now I can easily set a generic Ajax indicator to show and hide when the jQuery is making an Async call using: $('#indicatorId').ajaxStart(fu...