jquery

Accessing protected REST endpoint with JQuery

I have a site where members login to their account (FormsAuth). I would like to set up a RESTful service that I can access using jQuery. I would like to protect these services using the same FormsAuth. How would a third-party site be able to access these services? They would need to pass in the Principal/Identity to the service, right...

JQuery selector value escaping

Hey all, I have a dropdown list that contains a series of options: <select id=SomeDropdown> <option value="a'b]&lt;p>">a'b]&lt;p></option> <option value="easy">easy</option> <select> Notice that the option value/text contains some nasty stuff: single quotes closing square bracket escaped html I need to remove the a'b]<p> opt...

How to use jQuery to get the current value of a file input field

From what I've ready you should be able to use the 'value' property of a file input field to get the currently set path of that field. But when I do this: $('#fileinput').value() I get 'undefined'. The ID of the field is set to "fileinput" I'm sure. Does anyone have any thoughts on why this might not be working for me? And by the...

Adding options to a select using Jquery/javascript

What's the easiest way to add an option to a dropdown using javascript? Can this work? $("#mySelect").append('<option value=1>My option</option>'); ...

Problem with jquery append & appendTo

Hi All I was trying to use append to put the block content onto bottom of body and show with absolute position, but when display it my input checkbox becoming non clickable on on FF. Has anyone faced this kind of issue ? Thanks js: var box = $('#subbox'); box.css('top', 200); box.css('left', 300); $(document.body).append(box); ...

jQuery-UI Datepicker: Draggable?

(Hopefully) Simple question: Is it possible to make the jQuery UI Datepicker draggable? If so, can someone give me some sample code? ...

Unable to get Id of draggable divs in jquery. (using jqery ui)

For some reason the script below is unable to get the id of the draggable divs using attr('id'), but it works on the other static elements on the page. I am totally confused as to why this wont work and if anyone has a solution for me it would me much appreciated. $(document).ready(function(){ //$(".draggable").d...

[jQuery UI Tabs] Callback after ajax loading a tab

How can I apply some code to the content of an ajax loaded tab? I tried using $(document).ready inside the loaded content, but that prevented css styles from loading (don't know why). Is there a callback function? Should I use $(document).ready and styles inside the loaded document in some other way? If using $(document).ready inside t...

Using jquery, can I get the X and Y offsets of a particular element?

Using jquery, can I get the X and Y offsets of a particular element? ...

How to replace the currently selected text inside an html textarea?

How do I edit the selected text of a textarea form element? EDIT: as in edit it in-place, replacing the orignal text. ...

How can I remove the event handler once the click event has fired?

I have a click event I wired up on a div on my page. Once the click event has fired, I want to unbind the event on that div. How can I do this? Can I unbind it in the click event handler itself? ...

How do I remove characters from a textbox when the number of characters exceeds a certain limit?

I would like to implement a text box with a 140 character limit in Javascript such that when the 141st character is added that character is erased. I don't want to show any message or alert to user they have exceeded the limit. There is already a counter.re. Here is an example of what I want to do: http://titletweets.com/category/games...

Assigning random colors per session, for chat

I have an AJAX chat system that I'm working on and so far I have it working. One thing I want to do is have it so when the user name is displayed on screen, it is a unique color (like in an AIM window). How would I generate a random color to assign to the user's name for the particular session they are logged in for? The color would hav...

AJAX chat, auto scroll window

Duplicate Scrolling Overflowed DIVs with JavaScript I have an AJAX chat that outputs the messages to a div with overflow: auto so if it gets too long, the scroll bar comes up. Is there is a way to have it auto scroll to the bottom whenever a new message is added? Preferably using jQuery? ...

jQuery: draggable connect to sortable. draggable item has a different DOM from sortable list

I am now able to drag an item to a sortable. But the sortable list has a different DOM. <!-- The draggable items. Has the "original" DOM in the LI tags. --> <ul class="draggable_text"> <li><span>DRAG THIS A</span></li> <li><span>DRAG THIS B</span></li> </ul> <!-- This list has a different DOM in the LI tags --> <ul id="stagero...

Only fetch output when element is not being dragged

How could I change the code below so that when an element is being being dragged the script will stop fetching the output file until that element was released? $(document).ready(function() { //$(".draggable").draggable(); $(".draggable").draggable({ containment: '#container', scroll: false }); $(".draggable").draggable({ sta...

jquery ui datepicker dateformat

Hello, I gote some problems to get the dateformat right. After my date field has lost focus I want it to show like: dd-mm-yyyy but it has to be saved in the database like yyyy-mm-dd. . This is what i have so far: $("#birthdate").datepicker({ changeMonth: true, changeYear: true, altFormat: 'yyyy-mm-dd' }); Now it's...

document.ready not executing on every load

Hello! I have a strange problem. I have a jQuery document.ready function executing some script on the page. When I was testing it through opening the file with firefox/opera it worked. When I uploaded it to the server (I tried both my home apache and my shared hosting) it only works once in 10 loads maybe. What could be the problem? T...

Show ajax loading indicator not immediately but after a delay

My current web app project makes heavy use of ajax calls. Most of them are fast and respond almost immediately. So, showing ajax loader all the time is not necessary. But I want to show an ajax loader when ajax calls take longer then 250ms (or so). Otherwise the users might be confused and keep clicking on links over and over again. :) ...

How to overwrite jquery event handlers

I'll try to explain the problem with a simple code. var fireClick = function() { alert('Wuala!!!') }; $('#clickme').click(fireclick); $('#clickme').click(fireclick); So now it will obviously alert 2 times but i need it alert only once. Tried so many ways, but no result. Thanks. ...