jquery

Manipulating list items with jQuery

I am currently trying to manipulate a unordered list with jQuery, essentially I have a list of links in an unordered list, certain users only have access (all set server side) to certain files / pages. I was hoping to use some jQuery to remove a few list items from the DOM, simply because it's more appealing to me to not have the user c...

Using jQuery for first time, simple problem!

I have some markup like this: <p><a id="1" href="#">Link 1</a></p> <p id="1show" class="starthidden">Hi! I get shown when link 1 is clicked</p> <p><a id="2" href="#">Link 2</a></p> <p id="2show" class="starthidden">Hi! I get shown when link 2 is clicked</p> <p><a id="3" href="#">Link 3</a></p> <p id="3show" class="starthidden">Hi! I g...

IE is losing ClearType

I'm experiencing something really strange! I have a div that I'm hiding with JS (jQuery). Like this: $('#myDiv').hide(); Then when I make a fadeIn like this: $("#myDiv").fadeIn('slow'); then the text loses ClearType in IE but not in FF. If I go with toggle insted of fadeIn, then it's all fine. What is IE up to and is there any so...

How to extend jQuery to make it easier to retrieve the tagName

I am looking to extend jQuery so I can easily retrieve the tagName of the first element in a jQuery object. This is what I have come up with, but it doesn't seem to work: $.fn.tagName = function() { return this.each(function() { return this.tagName; }); } alert($('#testElement').tagName()); Any ideas what's wrong? BTW...

RubyOnRails 2.2 + Jquery UI Sortable & AJAX: This is how I did it. Is there a better way?

Hello, In a Rails 2.2 project, I'm having users put together a list of projects into a portfolio object (i.e.: PortfolioHasManyProjects). On the page is a Rails form for regular text, titles etc., as well as 2 sortable lists; the lists are used for dragging projects from the global-project-list into your portfolio-project-list. It is s...

Using JQuery Ajax REST to send and retrieve data from flickr flickr.test.echo method

i want to display whatever the response of flickr.test.echo was on the page using rest (jquery ajax - because thats what im using) i need to supply an api_key The REST Endpoint URL is http://api.flickr.com/services/rest/ To request the flickr.test.echo service, invoke like this: http://api.flickr.com/services/rest/?method=flickr.te...

jquery html attribute not working in IE

I am using country and state dropdowns in my form. Whenever the user selects the country in the dropdown, the respective states of the country will populate in the states dropdown. I am populating the states in the dropdown using ajax call. The problem is that the states get populated in Mozilla but it doesnt work in IE. I guess there i...

Jquery load page questions

I am relatively new to using JQuery and would like to use the load method to pull in content into my page as the site I am hosting with does not support any server side scripting. I want to to be able to run more JQuery on the pages that are being pulled in (via the load method) such as the accordian in the UI library. How would I get ...

Leveraging JQuery find or inArray method to find an item in an array

I was wondering if anyone knows of a way to use the JQuery find method or inArray method to find an item in an array. I can't seem to find anything in the docs. for example: var items = [{id:1, name:'bob'}, {id:2, name:'joe'}, {id:3, name:'ben'}]; var found = $(items).find("[name='ben']"); or var items = [{id:1, name:'bob'}, {id:2,...

How do I sort a date of format mm/yy with the jquery tablesorter?

I have a table wherein one of the columns displays the date in the mm/yy format viz. 12/08, 01/09, 02/08, etc. How do I implementing sorting on this column with the jQuery tablesorter (http://tablesorter.com) so that the dates are appropriately sorted? Using the default date format does not work as it expects a date of three elements (...

Best practice for AJAX calls in .Net 1.1

Well, my latest contract is forcing me into the antique world of .Net 1.1. Since I have been using jQuery and Rails for quite a while AJAX like solutions to problem keep on popping into my head and I can't help writing them. So my fairly straight forward problem is that I have 3 actions I need to perform on a record (insert, update a...

ASP.NET MVC and JQuery get info to controller

I am totally confused on how to do ajax stuffs with jQuery and it seems the more I try the more confused I get. At this point all I want to do is get data to my controller using jQuery ajax. Some code for my jquery ajax call is. $(function() { $('#buttonAddLink').click(function() { var AjaxLink = { title: $("#li...

Access DOM elements after ajax.load

I am inserting the HTML response from an AJAX call into my page, but then when I try to access those elements after they have been created, it fails.. This is how i retrieve and insert the HTML: $.ajax({url: 'output.aspx', data: 'id=5', type: 'get', datatype: 'html', success: function(outData) {$('#my_container').html(out...

Is there a way to determine when 4 images have been loaded using JS?

I have 4 images on a page. I want to trigger a JS event once all 4 images are loaded. I of course can't be sure which order the images will be loaded in, so I can't trigger the event on the last image. One thought was to have a counter, but I can't think of the best way to check when that counter is equal to 4 as I don't like the idea of...

Why is this wrong? (use of "this" with jQuery)

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"&gt;&lt;/script&gt; <script type="text/javascript"> function bigtosmalltriangle() { $(this).siblings("div.break").removeClass('triangle3').addClass('triangle1'); setTimeout ( "smalltomediumtriangle()", 400 ); } function smalltomediumtriangle() { $(th...

Clone a file input element in Javascript

I have a file input element that needs to be cloned after the user has browsed and selected a file to upload. I started by using obj.cloneNode() and everything worked fine, that is until I tried using it in IE. I've since tried using jQuery's clone method as follows: var tmp = jQuery('#categoryImageFileInput_'+id).clone(); var clone =...

prototype and jQuery peaceful co-existence?

I know very little about JavaScript but despite this I'm trying to cobble something together on my wordpress blog. It's not working, and I don't know how to resolve it, and hey, that's what StackOverflow is for, right? Firstly, the error message is: Error: element.dispatchEvent is not a function Source File: http://.../wp-includes/js/p...

Set value of textarea in jquery

I am attempting to set a value in a textarea field using jquery with the following code: $("textarea#ExampleMessage").attr("value", result.exampleMessage); The issue is, once this code executes, it is not altering the text in the textarea? However when performing an alert($("textarea#ExampleMessage").attr("value")) the newly set valu...

Most efficient way to find elements in jQuery

If I have a CSS class which I only ever apply to form elements, eg: <form class="myForm"> Which of these two jQuery selectors is most efficient, and why? a) $('form.myForm') b) $('.myForm') ...

Replace UpdatePanel with JQuery

I'm using UpdatePanel to asynchronously call a button click event in a page that calls a method in another class which writes out an XML file on the output. Is there a way to do this with JQuery instead of UpdatePanel? ...