jquery

jQuery split long ul list in smaller lists

I have a long UL list I need to break up in smaller lists containing about 20 items each. I was thinking I could use something like $(function() { $("ul li:nth-child(20n)").after("</ul><ul>"); }); but that's not the case. Any idea how to use jQuery in a way that uses minimal CPU? Thanks ...

Data source for jQuery auto-complete plugin

Hey guys, I am using jQuery's auto-complete plugin for a simple search form. I am having trouble converting my JSON object data into an array for usage with auto-complete. My code: var listOfOrderedByNames = getAutocompleteData(); $('#OrderedBy').autocomplete(listOfOrderedByNames); function getAutocompleteData() { var output; ...

jQuery Syntax error in Safari

Can anyone tell me why this would generate a syntax error in Safari and not in Firefox? toggle = function(){ $("#type_new").hide(); $("a[class^='toggle']").unbind('click').click(function(){ $.class = $(this).attr("class"); if($(":input."+$.class+".text").is(':visible')==true) $(this).find("small").html("Add New Typ...

JQuery Issue in IE7

I'm new to JQuery... this code doesn't work in IE7 but does in FF & Chrome. It says its giving me a syntax error, help! $(function(){ $("#bClose").click(function() { $("#ContactRepeat").slideUp("normal"); }); $("#bContact").click(function() { if ($("#ContactRepeat").css("display") == "display"){ $("#ContactRepeat").slid...

JQuery Ajax Post - JSON works with GET but NOT with POST

Hello All: I am trying to send json string to the server using jquery ajax, as below. It decodes correctly when GET is used, but does not work when POST is used. Any suggestions? $.ajax({ type: "GET", url: "../pssops21/php/insertTempTransData.php", data: 'data=' + strSelectedItems, dataType: 'json', async: false, success:...

jQuery checkbox event not firing?

I have a page with checkboxes, one of which is a select all button. So when the user clicks select all, it checks all the other boxes, and when another box is clicked, it unchecks select all. Here is the code. $(document).ready(function(event){ //alert('wtf'); $('#mailSubscribeAll').click(funct...

how do you pass in a selector into jquery editable plugin

i am trying to pass in a selector into the ID variable but this doesn't seem to work as it blows up at runtime. what is wrong with the below syntax ? <script type="text/javascript"> $(document).ready(function() { $(".dblclick").editable('<%=Url.Action("UpdateSettings","Photos", new { id = $(this).attr("id") }) %>', { ...

padding breaks jQuery selector?

I spent 2 hours this morning trying to figure out why my jQuery function worked in one part of the page but not another. I finally narrowed it down to vertical padding on a container. If I had this in my CSS: div.collapsiblePanel { padding: 0px 1%; } then, via jQuery, I can find the parent (.collapsiblePanel) element and could trave...

jquery: using appendTo in second to last row of table

I have a piece of the DOM that I'd like to insert into my page. Currently I'm just blindly using: $(myblob).appendTo(someotherblob); How do I do the same thing, but append myblob to the second to last row that is within someotherblob. someotherblob in this case is a table and I want to inject a row above the second to last one. ...

Problem accessing OnChange javascript event of Radio Button

I'm running in to the same problem this individual has. Specifically, I'm trying to get a clientside onchange javascript event to fire for my Radio Button. Unfortunately, the code gets rendered with the onchange located on a span surrounding the radio button instead of on the radio button itself. I am using other javascript within the...

Getting JQuery UI Sortable to work on asp.net ListView items?

I have the following ListView in which I am using the JQuery UI sortable function to be able to sort the items in the ListView. The problem is that I can't put a sortable class on the table in the ItemTemplate because it does not work, if I put a class="sortable" on the outer div, it works, but it allows me to sort everything within the...

dynamic database driven accordian

Hello, I am trying to create accordian control dynamically by reading the values from the database. Could someone please point me to the example code on how to start. Many Thanks ...

jquery and grouping checkboxes

So this is what I have: <script src="scripts/jquery-1.3.2.js" type="text/javascript"></script> <script> $().ready(function() { var allVals = []; $("input[name^=utType]").each(function() { var input = $(this); var name = input.attr('name'); var num = /\d+$/.exec(name)[0]; if ($(this).chec...

Jquery - Add a dynamic class to another DIV

OK, perhaps the title doesnt best explain what im trying to achive but if I can explain better hopefully someone can help me out: Im using the following code to select the text held within <a> and add it as the class of that element: $(".nav a").each(function () { var self = $(this); self.addClass(self.text()); }); So for instanc...

disable asp.net validator using jquery

Hi, I am trying to disable validators using jquery. I have already looked http://stackoverflow.com/questions/400346/disable-asp-net-validators-with-javascript and couple of others doing the same. It seems be working but its breaking. My code: $('.c_MyValdiators').each(function() { var x = $(this).attr('id'); var y = doc...

Click the class, hide the id

I want to associate a click handler with a class and then hide the element associated with the particular id that was clicked: $(".myclass").click(function() { $("#myclass_123").hide(); return false; }); Obviously the code above doesn't work because it doesn't calculate the "_123" part. The ids in the class have the same name...

jquery ui drag/drop getting position from multiple draggables

I have a droppable container with >1 draggables in it. I want to simply be able to see the position of each draggable every time any one of them is dragged. Sounds easy, but I'm having a tough time figuring it out. Here's what I have: <script type="text/javascript"> $(function() { $("#draggable").draggable({ containment: '#droppable' }...

Using jQuery.event to detect the link that was clicked

I am trying the following: var showTooltip = function(event) { if(event.target == "<a href=\"view_repair.php\">") { $tooltip .text('View full repair details') .fadeIn('slow'); positionTooltip(event); console.log(event.target) in Firebug gives <a href="view_repair.php"> But the code inside the if statement isn't being run. Is th...

jquery datepicker default date

I am trying to get a attribute of a date picker to pull the date dynamically, however I get uncaught exception errors when I try to set it to a variable. The errors only occur on pages that do NOT have the calendar (inline). How can I pul the rel tag from the selector without getting this error? //Event Calendar Home Page and Listing f...

jQuery grabing the color of an element PRE :hover

I'm trying to create a generic 'flash of color confirmation' function where it'll flash the background of an object to green and then fade out to whatever it's existing color was. So I may have two elements that I call this on click(): li background-color: red li background-color: black If I click the first one, it'd fade from green ...