jquery

jQuery events .load(), .ready(), .unload()

Hi folks, Just a simple question, for the jquery event. Are the .load(), .ready() and .unload() run in order when the DOM is loaded? The answer seems yes when I see the jQuery Documentation. <script type="text/javascript"> $(window).load(function () { // run code initializeCode(); }); $...

Saving selected rows in a jqGrid while paging

I have a jqGrid with which users will select records. A large number of records could be selected across multiple pages. The selected rows seem to get cleared out when the user pages through the data. Is it up to the developer to manually track the selected rows in an array? I'm fine doing this, but I'm not sure what the best way is....

jqGrid footer cells "inherits" CSS from cells in the main grid

I have a footerrow in my jqGrid where I sum up the values in some of the columns. I set the footer using the 'footerData' function when the grid has completed loading. This requires the 'footerrow' property in the grid-options to be set to 'true'. Some of the columns which I don't sum up have CSS applied to them (to show some icons in th...

JSON - msg.d is undefined error

Hi - Webmethod returns an array of objects - something like this {"d": [[{"Amount":100,"Name":"StackOverflow"}, {"Amount":200,"Name":"Badges"}, {"Amount":300,"Name":"Questions"}]]} On the client-side, when the JSON is referenced using msg.d, I get a msg.d is undefined error. I am using jQuery JavaScript Library v1.4.2 How do I a...

jQuery getting text-shadow variabile

Hi, I want to get 4 variables when I click on a span that have the CSS3 text-shadow propriety. So for a css propriety of text-shadow: -4px 11px 8px rgb(30, 43, 2);, my code should be: $("#element").click(function () { var text-shadow = $("#element").css("text-shadow") }); Would it be possible to get it split like: var y = "-4px"; var...

unable to get values from JSON converted from XML

I have passed some JSON to my page via a webservice. I used JSON.NET to convert XML to JSON. The JSON output looks ok to me, but I am unable to access some of the items in the response. I am not sure why it is not working. I am using jQuery to read the response and make the webservice call. Even when I try to read the length of the array...

Jquery to find a name on html page and add hyperlink

Here is my example: I have a a website that contains the following: <body> Jim Nebraska zipcode 65437 Tony lives in California his zipcode is 98708 </body> I would like to be able to search for zip codes on the page and wrap them with hyperlinks like: <body> Jim Nebraska zipcode <a href="/65437.htm">65437</a> Tony lives in California...

Is there a 'has focus' in JavaScript (or jQuery)?

Is there something I can do like this (perhap via a plugin) if ( ! $('form#contact input]').hasFocus()) { $('form#contact input:first]').focus(); } Basically, set focus to the first input, but only if the user has not already clicked into anything? I know this will work too, but is there anything more elegant? $(function() { var...

Jquery Apache - IE problem

I'm having a button tag on my page with a value. <button class='btn' value='value'>show value</button> I have this jquery code : $('.btn').click(function() { var w = 'value = '+$(this).val()+' / text = '+$(this).html(); alert(w); }); In FF, no problem the result is ok (display: value = value / text = show value). The ...

jQuery UI Tabs - 2 Problems

I'm using jQuery tabs and I'm having some problems. Let me detail them for you here and then I'll put code below: PROBLEM 1: I have a total of 6 tabs (default tab in local div, other 5 loading via Ajax). When the page loads, I need the 3rd tab to be selected by default. Easy. Problem is, say I link to http://example.com/index.html#...

jQuery Selectors - where item does not have children with a certain class

I want to select list items that are immediate children of #nav, that do not themselves have immediate children with an 'active' class. This is what I think it should be but it does not work: $('#nav > li:not(> a.active)') ...

How can I pass a variable into jQuery timeout

I'm seriously struggling today. I need to pass a variable, or even better an object, into a timeOut as such (example) : $('.x').each(function() { setTimeout(function() { alert ($(this).attr('id')) },10000); }); Obviously what happens is that the timeOut doesn't have reference to the original $(this) Help ? ...

Bug in IE with jQuery highlight? Highlighting is sticking on some elements.

Is there anything wrong with this line? $('#' + $(this).attr('id') + 'title').effect("highlight", {}, 5000).fadeIn(1000); It's being applied to a set of divs in cycles - the first time it shows them, and then as it keeps going round it highlights them again (as they are already shown.) Only, in IE7 and IE8 the highlight seems to stic...

How to set cell's background in HTML table ?

I would like to set the background of a cell in HTML table to be like this. What are my options besides using an image as background ? Are there any predefined backgrounds like this ? Maybe dotted, or diagonal lines backgrounds ? In case of image background, if I don't know in advance what would be the size of the cell, what image size...

Invert order of HTML elements

I have the following configuration: <div><div id='box1'>&nbsp;</div><div id='box2'>&nbsp;</div><div id='box3'>&nbsp;</div><div id='box4'>&nbsp;</div></div> what i need to do is to invert the order of the divs <div><div id='box4'>&nbsp;</div><div id='box3'>&nbsp;</div><div id='box2'>&nbsp;</div><div id='box1'>&nbsp;</div></div> is t...

Clear dropdown selection on radio button click

I have a set of radio buttons. When primary is selected, the Primary Company field is hidden. I would also like to at this time clear the drop down selection. How can I do this? <p> <label>Company Type:</label> <label for="primary"><input onclick="javascript: $('#sec').hide('slow');" type="radio" runat="server" name="...

preload image with jquery

Updated: firs append a empty image and a span with some text hide the loading image, after it's load it's show the image var pathimg = "path/to/image" + "?" + (new Date()).getTime(); $('#somediv').append('<div><span>loading..</span><img id="idofimage" src="" alt="" ></div>') jQuery("#idofimage").hide().attr({"src":pathimg}) ...

jquery range slider not sliding after changing min value after init

I init my range slider on loading of the page: $("#slider").slider({ range: true, min: 634606, max: 734818, step: 1, values: [634606, 734818] }) on user input (html form) i retrieve data from the server with an ajax request. The data has to limit the slider (user input). I'm ...

Loading dynamic external content into the Div of another on click

Trying to load an external php file into another onClick. Iframes will not work as the size of the content changes with collapsible panels. That leaves AJAX. I was given a piece of code HTML <a href="#" id="getData">Get data</a> <div id="myContainer"></div> JS $('#getData').click(function(){ $.get('data.php', { section: 'mySection...

How to eliminate a prefix of '0' before a number using jquery

I need a jquery script section that checks to see if the first digit of a textbox entered number string is a '0' and eliminate it if so. For example "044055" needs to become "44055" ...