jquery

jQuery: Get height of hidden element in jQuery 1.4.2

I need to get height of an element that is within a div that is hidden. Right now I show the div, get the height, and hide the parent div. This seems a bit silly. Is there a better way? I'm using jQuery 1.4.2: $select.show(); optionHeight = $firstOption.height(); //we can only get height if its visible $select.hide(); ...

jQuery live search - filter out HTML

I have a live search box running on a website, it all works and looks great, however when i type something in, then scroll down the list to make a selection, when i press enter, the HTML that makes the formatting of search list goes into the input box as whitespace. Does anyone have any ideas on how i can filter this whitespace out? Se...

jQuery fade effects and Ajax login

Hi, I'm using the following piece of code to login a user via Ajax. //Capture the login_ajax form $("#login_ajax").submit(function () { //First we fade out the header-login div $("#header-login").fadeOut('fast', function() { $(this).html("Loading").fadeIn('fast'); //Fade in loaading }); $.post("db/login.php", ...

Use javascript to randomly append CSS class to one list item

Hey, I don't have any code because I don't know how to do this. I'm looking to use jQuery / javascript to randomly append the CSS class "active" to one list item within a an unordered list id'd as ul#sliding_panels. ...

jquery: scroll to an element within an overflowed div

i have 20 list items inside of a div that can only show 5 at a time. what is a good way to scroll to item #10, and then item #20. i know the height of all the items. the scrollTo plugin does this, but its source is not super easy to understand without really getting into it. important - i dont want to use this plugin lets say i have a...

Hide and show controls on a condition

I have a url format http://www.xyz.com/DisplayPost.php?postid=200 On the page, I have a div called div1 which gets it data from Google Adsense (script). Here's what I want to do: Start by hiding the div. Then I want to detect if the url does not have "postid=250" in it and display the div. How can I do it using jQuery. What css attri...

pick a number 1 to 10 on web page

Hi All, I want to create a web page where a registered user picks a number from 1 to 10. When a user picks a number that number is removed from the available list. Is there a way to guaranty that no 2 or more users can have the same number? Thanks, rod ...

Problem reading the XMLHttpRequest.status when redirecting

I am requesting something with $.ajax and i am getting a 302 or 200 status after the call. I want to insert something into the DOM when status is 200 and make the actual redirect when the status returned is 302. For that I am using: (took that snippet from a diffrent thread here) complete: function (XMLHttpRequest, textStatus) { al...

Calling blockUI and unblockUI in combination with jQuery validator plugin

I have a very complex form with the validation working correctly. However, since it can take awhile for the validation to complete, I'd like to use blockUI to be called when I click the form's submit button to prevent confusion and double-submissions. I can't quite figure out how to do this. My code looks like this: $("#credential")....

Add 1px to padding of element with jquery

How do I add 1px to the padding of a div element with jquery? The div element might have any amount of padding beforehand, and I want to increment the padding by 1px. ...

Javascript: dragging divs

Does anybody know how dragging objects (divs) around on the screen by mouse-click-and-hold implemented using pure JS? I am interested in the native JS functions and the technique which may be used. Further, how can we do this using jquery? ...

jQuery acting weird

So, I wrote a small page: <html> <head> <script type="text/javascript" src="jquery.js"></script> <script> function slide() { $("#d").slideUp("slow"); document.getElementById("d").innerHTML=Math.random(); $("#d").slideDown("slow"); } </script> </head> <b...

Problem loading dynamic content of html + js via ajax

Hi, I'm using the jQuery UI Tabs plug-in to load html pages via ajax, so I have the following html: <div id="tabs"> <ul> <li><a href="pageWithGallery.html" title="pageWithGallery">Gallery</a></li> </ul> </div> The loaded page pageWithGallery.html contains a jQuery gallery which plays on $(document).ready. this however do...

How to clear all textboxs in a DIV using jQuery ?

I have some asp textboxs in a div container. I just want to clear those when i am clicking the CLEAR button. I say common class 'text' for all textboxes and then wrote this jQuery $(".text").text(""); It's not working .. How to do this ? I need the most efficient code . ...

How to do a horizontal scroll on mouse wheel scroll ?

Just now, accidentally, i stumble upon http://www.benekdesign.com/ . Here on mouse wheel scroll it performs horizontal scroll. Truly speaking i didn't like this feature. It was a bit irritating. But still, Please tell me how to achieve the same. Edited Okay, firebug says he is using /* Horizontal Tiny Scrolling - a smooth scrolling...

Customize JQuery Accordion behaviour

I am using JQuery's accordion widget. I need a simple generic example which shows how to setup an accordion on a set of divs. When the user selects/expands/activates one of the divs then that div should look different (for example change the background color) than the other divs. Is it possible to do this by just using the accordian's fu...

Jquery - event does not work on the newly created element

Hello, I have a simple comment section where users can post comments to another users post - It works pretty much in the style of facebook wall where a user can write something on the wall and other can comment on it. So I have this form where the user can enter anything and when he submits - that information is inserted in the databas...

jQuery and long int ids

I've faced with a next problem: In our database we have objects with ids, like 4040956363970588323. I'm writing some client-wizard on jQuery for interacting with such objects. Client receives base data about objects trough an Ajax request, like: $.ajax({ url: "/api/pages/", type: "get", dataType: "json", ...

Loading off screen, Ajaxload

Hi, I have a question on how I would go about to show an Ajaxloader .gif until a page is loaded. The trick for me is that; The page currently is built so that the page loads one time, I have a tab system, so it loads everything, and then go between the divs. Because this site is made so that even users with low bandwidth can enter it, y...

jquery plugins: localisation and facebox conflict

hello, I'm having a problem trying to get working those 2 plugins together: Localisation (for translating the javascript) and facebox (everyone knows that one right?) I can make them work separately without any problem, but when the localisation plugin is loaded and I clic on a link that launches a facebox modal, the ajax request start...