jquery

Get element by id via regex jQuery

Html element contains complex & unique id, composed from namespace as prefix and incremented index - as postfix. I try do it with wildcard expression for id. If to use simple way without namespace, that it works fine: $j("[id*=service_selected_]").click(function(){ ... In order to keep uniqueness,i need provide namespace part within...

Running a script based on a dynamically generated DOM element

I'm working with a third-party product. It uses JavaScript (non-JQuery) code on the page to generate DOM elements on the fly. Is it possible to run a jQuery script whenever this third-party code generates a DOM element matching a given selector? To explain in another way, I don't want to try and integrate with that code. I just want to...

ASP.net dynamic drop down lists, how to use JQuery and AJAX instead?

I have written some code that works using ASP.Net, C# and AJAX update panels. I have created this user control, in which a repeater is populated by the contents of the BusinessTier datatable. For each business tier, there are associated business levels which populate a drop down list from the BusinessLevel datatable. One business level i...

JQuery hover only applies to the last element?

I have a little trouble understanding scope and lifetime using javaScript and jQuery. I have a function that takes an array of custom objects (gps is an array of groups) var currentGroup; for(var index = 0, length = gps.length; index < length; ++index) { currentGroup = gps[index]; var newGroup = $('<li id="groupno-' + currentGro...

Simple jQuery If then

Losing my mind on this one.. How can I do something as simple as.. If div has class "something" then make div#test have a class of "awesome" <div class="something">hey there</div> <div id="test">Am I awesome?</div> Much Thanks! ...

jquery post when done

I have a script that does a jquery AJAX post and then should redirect to a different page. The problem is that it is sometimes redirecting before the post completes. There seems to be a couple of solutions but I can't get any of them to work. Thanks for your help! Here is my code: $.post("cart.php", { 'products[]':postvalues }, function...

jQuery iterative Timer

I want to create a jQuery iterative timer. For this I wrote the following script: $(document).ready(function(){ var t; function x() { alert('x') t = setTimeout("x()",1000); } x(); }); First time the function x() called successfully. But from the next function x() is detect as undefined. What could I...

Figuring out when images are loaded after they are inserted using jQuery.load('url.html')

I currently have something similar to this, it loads a div on the target page that has images in it. $('a.galleryNext').click(function(){ // chnage the image to loading $("#info").html("LOADING"); $("#currentGal").load("gallery.php div#gallery"+currentgallery, function(){ //this fires much too early, the images are s...

jquery acces content loaded via ajax call

i'm trying to write a jquery plugin that when i click on a image to pop an alert message. Those images are loaded via load() method. Is there possible to load the plugin on document ready and the plugin to have acces to the loaded content? i don't want to use a callback function, i just want to include the plugin in the html page and the...

Why does jQuery's $().each() function seem to be losing track of the DOM?

I've recently started encountering a very strange problem. To be honest, I'm not entirely sure how to describe it other than to just show it. Here's the relevant HTML: <div class="component container w100 noEdit" id="contentWrapper"> <div class="component container w50" id="container1"> <div class="component text w50" id="text1">...

Using JQuery, how do you detect if the value of a text input has changed while the field still has focus?

I noticed prior to posting this question that there have been similar questions posted on this topic before, however the user isn't interacting with the text field by using the keyboard in this instance, in such case binding the text field to the "Paste" action or any of the other nifty suggestions wouldn't work in my case. Our users ar...

Remove whitespace and line breaks between HTML elements using jQuery

Using jQuery, I'd like to remove the whitespace and line breaks between HTML tags. var widgetHTML = ' <div id="widget"> <h2>Widget</h2><p>Hi.</p> </div>'; Should be: alert(widgetHTML); // <div id="widget"><h2>Widget</h2><p>Hi.</p></div> I think the pattern I will need is: >[\s]*< Can this be accomplished without...

jQuery datePicker below UI dialog?

Hi, See Example After clicking the show container link the datepicker component - 2nd input - is shown below the UI dialog. What should I do to show it above the UI dialog? ...

jQuery hover over child elements makes quirky effects

Hi I've got this markup (simplified): <div class='item'> <a> one link </a> <a class='trash'><img src='trash.png'/></a> </div> I'm highlighting the div when the mouse enters, and showing the (otherwise hidden) 'trash' link (it's like a tiny trash bin) so the user can delete the link. I can't use 'hover' effect, because I need the...

how can i fix ie select width?

I don't have enough space to change its width on click or any stuff like that. I need the main select to keep its orginal size with wider options. I'm using jQuery / IE6 10x ...

Copy text to the client's clipboard using jQuery

The workflow is simple: You click inside a textarea. The text is copied to the client's clipboard. Display notice to the user. How do you do it? ...

Explicitly calling the autocomplete function in jquery autocomplete plugin

I have a text field to which I have a jquery autocomplete event attached. However, due to some reasons, I dont want the search results to appear when the user types, but rather when a button is pressed. I know this sounds lame, but I have my reasons. How do I trigger the autosearch results to appear by calling an explicit function? ...

Dialog keypress and DOM

Hi - I'm trying to use jQuery's keypress to trigger a button click on a modal dialog created using the jQuery dialog function. The problem is, with the following code, it works the first time around (pressing enter presses the Save button) but I get erratic behavior when I close the modal dialog and reopen it. I'm thinking some variant o...

Call a PageMethod w/ jQuery using GET

I can call call my ASP.Net page methods fine if I use POST but if I try GET it fails. Any ideas why? var url = encodeURI(acx.opts.queryURL + "?t=" + acx.input.val()); acx.requestExe = $.ajax({ type: "GET", url: url , //data: "{\"t\":\"" + acx.input.val() + "\"}", //Data To Send If POST contentType: "appl...

wait untill previous .append() is complete [jquery]

Hi,I am new to Jquery. Please excuse me if this a very basic question. how can we make 'append' wait until the previous 'append' is complete. I am appending huge amount of data so the present append should check if the previous append is complete. I am able to do this by giving all the append's independently with some time delay. B...