jquery

jQuery replace doesn't work

Script replaces rel attributes to class. Full code - http://jsbin.com/efozi3/8/ It doesn't work for links, where used more than 2 values in rel. An example - the first item: <a class="s1" rel="t1 t2 t3" href="#">One</a> First three <li> should become blue, but now only the first one does. <li class="t1"> <strong>1</strong> ...

How to tell if an item is on the screen (WITHOUT using scrollbars)...

Hey, Is there a way that I can only render the elements on the screen and leave those others to be rendered when they come into view? Basically like 3d culling, but on a website ^.^ [edit] I take it that this isn't possible then? [/edit] [edit2] I tried LazyLoad (jQuery plugin) but that initialised on windows scroll [/edit2] [edit3] S...

Dynamically set incremented link id using jquery?

Hi, I'm just getting started with jquery. I have 3 divs with a class of .linkCol which each contain a lot of links. I have been manually setting the id of the links but I know this is going to be a problem in the future. If you look what i have so far, I have had to add an id manually to all my links. var ttlLinks = $(".linkCol li...

Access Session data from ASP.NET page using jquery...

Hi guys, I'm trying to pass a variable stored in the Session object of my ASP.NET page with jQuery, representing the progress of a process running on the server as a percentage. i.e: Session['progress'] = 37; I've looked through some of the answers here; my code uses the same method as a question aswered correctly here: <head> ......

jquery autocomplete and formatItem / formatResult

I am trying to hide some data from the autocomplete drop down. This is what I got: $("#sVendor2").autocomplete("vendors2.cfm", { width: 300, selectFirst: false, autoFill: false }); Now, my vendors2.cfm page displays #vendor_name# (#vendorID#), #vendorSiteCode# (#vendorSiteID#): #address#, #city#, #state#, #zip#| What I want t...

Getting 3 identical jQuery slideshows to start on time in Internet Explorer

I have 3 slideshows running next to each other on one page. They all use the same jQuery script http://css-tricks.com/anythingslider-jquery-plugin/ In Chrome/Safari and Firefox they all start the sliding animation at the same time and give the desired visual effect on the page. However, in IE they don't all start together, they a...

"Easter Egg" in link - activated by CTRL + click

Hi guys I'm working on a project for a client, and we want to make a easter egg, when you click some of the letters in the logo. There are three letters, and you have to click in the right order, before it activates the easter egg. However, because it's in a link, I wondered if I could use CTRL+Click...? I've searched the web, but coul...

How can I get newlines into $.text(), or, how do I make $.append() safe from HTML?

I have a chat window (using a <div>) that sometimes needs to get multiline entries. Until now, I've simply replaced incoming \n with <br> and displayed the text with .append(). Unfortunately, I've discovered leaving a naked .append() based on user input allows the user to insert arbitrary HTML, which will then be executed by the browser....

Why does jquery fadeOut act strangely with setTimeout?

I have this code: clearTimeout(tooltiptimeout); tooltiptimeout=""; $("#tool").fadeOut("slow").queue(function(){ tooltiptimeout=setTimeout(function(){ $("#tool").css("left",item.pageX-33); $("#tool").css( "top",item.pageY-95); $("#tool").fadeIn("slow"); }, 1000); $(this).dequeue(); }); What it shoul...

jQuery image rotator

Hey, I'm trying to make this simple image rotator but, as usual, my code doesn't work. I want to swap between 2 images ("image1" and "image2") $x = 0; function rotateImage(){ if($x == 0){ //if function is being called for the first time $x = 1; } $(".window").html("<img src=\"../images/image" + $x + ".png\" />"); ...

jQuery: After mouseOver on link#1, 2 and 3 - activate show content

Hi there I'm working on a easter egg, where you have to activate some links in the correct order, before the secret is revealed. I can't get this script to work. I guess I've wrote something wrong, but can't see what it is... <script> $(document).ready(function() { $('#show').hide(); var StepOfThree = 0; a...

RESOLVED: making a paragraph animate along with rotating image in jquery

Hey all, The problem was the text failed to scroll with images. $(function() { $('#slideshow').crossSlide({ sleep: 2, fade: 1 }, [ { src: '../images/img1.png' }, { src: '../images/img2.png' }, { src: '../images/img3.png' }, { src: '../images/img4.png' } ...

Getting the Id of a jQuery element

<div id="test"></div> $(document).ready(function() { alert($('#test').id); }); Can someone please explain to me why the above doesn't work, and tell me how I can get the ID of a jQuery element that has been passed into a function. ...

a tag toUpperCase comparison

Hi All, Given: <div> <span><a href="#">abc</a></span> <span><a href="#">def</a></span> </div> Is there a way to do a string comparison with toUpperCase() between a given string value and the link text (as shown above in the span collection) and if it doesn't match hide the span? Anyway to incorporate "contains" in the mix? Thank...

jQuery dynamic canvas creation, $ctx.getContext is not a function

When I try to execute this in jQuery I get $ctx.getContext is not a function in firebug. var $ctx = $( '<canvas />', {width:'100', height:'100'} ) $widget.append($ctx) $ctx.getContext('2d') Any idea why I get this error? How do I dynamically create and initialize...

jQuery :input[value] with Radio buttons

I'm using: var data = $("form :input[value]"); To get all the values in a form and passing the data to an ajax script. My problem is it doesn't work with RADIO buttons - it always sends the last value for the radio group. Any ideas on how to get the checked radio button along with all the other form values? ...

Generate JSON - how to improve performance

Here is what I am doing currently. Get data from database in DataTable (max records would be 100 but stored proc will search against more than 500,000 records. I already took care of search optimization in database. I am looking how I can improve the performance as much as I can in step# 2 and step# 3 below.) Create a generic list (Li...

jquery sortable: How can I use a handle outside of its sortable object

Hey My problem is like that: My handle is located outside of the sortable object (not outside the DOM, but outside his visible borders). It is positioned absolute on the left with negative margins to the left, and write this handle using prepend on mouse over, and because of that, when I drag him, he doesn't sort the object. He just d...

jQuery Problem with check checkbox when I check it

Hello i have problem. I have that function: $("#tabela tr").toggle(function(){ $(this).addClass("zaznaczone"); $(this).find(" :checkbox").attr("checked", "1"); },function(){ $(this).removeClass("zaznaczone"); $(this).find(" :checkbox").attr("checked", ""); }); and it's fine when i click on "tr" but when i click on chec...

jquery calculation question.

Hi, I have this code: <div> <input id="number" type="text" /> <select id="Selection" name="D1"> <option>Plus 1</option> <option>Minus 1</option> </select> <input id="result" type="text" /> </div> How could I calculate any number entered into the input "number" based on the value chosen from the select ...