jquery

jquery: set variable based on one class from an element that has more than one class

Hi I'm trying to make a table who's columns and rows highlight on hover (I realise there are jquery plugins out there that will do this, but I'm trying to learn, so thought I'd have a stab at doing it for myself.) Here's what I've got so far: $('th:not(.features), td:not(.features)').hover(highlight); function highlight(){ $('t...

Internet explorer says Object doesn't support this property or method

This line is 79: window.addEvent('domready', function(){ mySlide = new Fx.Slide('advert'); mySlide.hide(); }); It also does not like this line: this.wrapper = new Element('div', { 'styles': $extend( this.element.getStyles('mar...

jQuery Partial Selectors

I have a number of tables, which have nested tables. I using jQuery to hide some of the table cells as a number are empty or the contents irrelevant. I use jQuery to hide all TD's and then jQuery to show them, for instance, if they contain a <P>. Unfortunately some of the TD's don't contain anything but still need to be shown. The clas...

JQuery recursive function?

How can I call a function from inside the function, so it becomes recursive? Here is my code, I have added a comment where I would like to start the recursion: $('a.previous-photos, a.next-photos').click(function() { var id = $('#media-photo img').attr('id'); var href = $(this).attr('href'); href = href.split('/'); var p...

Jquery Select DIV below Table

I have some simple markup: <table> <tr> <td>Menu Item</td> </tr> </table> <div> <table> <tr> <td>Menu Item Sub Menu</td> </tr> </table> </div> Im currently hiding the DIV, however if you click the in the first table I want it to .show() the Table in the div. Does that make sense? I should really get my head around, p...

jQuery Tabs with Masterpage - space between tabs and tab content

I'm trying use jQueryUI tabs in a content control. The code below works on a page that doesn't use a MasterPage. When I use it in a content control there is a large gray space between the tabs and the content in them. How do I get rid of this? I'm using jquery calendars and accordions with no problems in the content pages. There is...

Feature detection in jquery : test if browser return nodes of type Text_Node

Hi, With jQuery.support and without using jQuery.browser how would I know if the browser would return nodes of Type of Text_Node ? Ex: Would the value of $(this).contents().length be the same in Firefox and IE if there is nodes of type Text_Node ? Found my response on stackoverflow: jQuery.support.leadingWhitespace ...

I can't make autocomplete work with ajax call to my webservice

Hello, I followed the directions in this post: http://stackoverflow.com/questions/457183/how-can-we-integrate-jquery-autocomplete-using-asp-net-webservie-and-sql-databas to make jquery-autocomplete plugin work with my webservice on asp.net, but it just won't work. Autocomplete works if I do local data. I'm also able to make calls to ...

Get mp3 total track time using either javascript or ASP.NET

I am using the below jQuery plugin for playing mp3 www.happyworm.com/jquery/jplayer However, there is a bug in Flash that the total play (track) time won't show up correctly UNTIL AFTER the whole mp3 is completed downloaded. I wonder if there is a way to work around this to get the correct total time using either javascript / another...

JQuery load script on a click event

$('#selector').click(function() { // here I would like to load a javascript file // let's say /js/script-on-click-event.js }); Is that somehow possible? I'm not sure but I remember reading about a function that does this in JQuery documentation but I cannot find it here, maybe it's been deprecated or I saw it elsewhere? Basica...

How do I prevent a parent's onclick event from firing when a child anchor is clicked?

I'm currently using jQuery to make a div clickable and in this div I also have anchors. The problem I'm running into is that when I click on an anchor both click events are firing (for the div and the anchor). How do I prevent the div's onclick event from firing when an anchor is clicked? Here's the broken code: JavaScript var url = $...

Jquery - tell when the hash changes?

Hey SO, I'm trying to make my site respond correctly to the back button. I've saved that hash of what I want it to do, but I don't know the hook for jQuery to be able to tell when the hash changes. It's not .ready(), because the page doesn't reload. What do I use? Edit for a bit of clarity: I'm using an iframe, so I can't tell when...

FireFox / JQuery / Dom : Not returning 'rowIndex.

I am writing a JavaScript function to highlight the row and column of a clicked cell. This function must take into account cells in previous rows that use "rowspan" to protrude down into the selected row - because this causes the cell indexes to differ from the "apparent" index. I.E. every cell in the second column of a table does not ...

Image Map w/Image-Based Rollovers Bounded by AREA Coordinates, jQuery if Possible

Basically I need this: http://plugins.jquery.com/project/maphilight ...but instead of just having the <AREA> tags recieve a border or fill color on rollover, have them recieve a background image. The image needs to be clipped by the shape of the <AREA>s. Any ideas? Basically the setup I have is as follows: <img usemap="#map" /> <map...

Are these really different functions? jQuery.extend()

The jQuery documentation covers the function jQuery.extend()s twice, giving it different definitions. The first relates to extending the jQuery object itself: http://docs.jquery.com/Core/jQuery.extend#object. The second relates to extend an input argument: http://docs.jquery.com/Utilities/jQuery.extend Are these two usages of the sam...

How good is jQuery at coexisting with other Javascript libraries?

I am working on a server-side framework. Here and there I have been adding hand-crafted javascript to do things on the client side. However this is becoming more and more painful and from what I heard I think jQuery can be of help. The issue is that as this is essentially server side stuff, I don't want to obligate my users (assuming ...

Selecting li from unordered list using ul and li id's

I'd like to obtain a li item from an unordered list using the id attribute of both elements as part of the selector. This is an example of how I made it work using the ul css class: var listItem = $('ul.selectedItems li#' + opt.list[i].ID); I tried to use the following approach with no luck: var listItem = $("#" + opt.name).childs.f...

JQuery datepicker with time picker?

I am looking for a JQuery DatePicker with a time picker which can work with ASP.NET. I found http://milesich.com/timepicker/ which looks nice but I am getting an 'Error: $("#hourSlider").slider is not a function.. error from their timepicker.js Also found http://code.google.com/p/dyndatetime/ but the time picker is clunky. Any other re...

How can I Animate an Element to its natural height using jQuery

I'm trying to get an element to animate to its "natural" height - i.e. the height it would be if it had height: auto;. I've come up with this: var currentHeight = $this.height(); $this.css('height', 'auto'); var height = $this.height(); $this.css('height', currentHeight + 'px'); $this.animate({'height': height}); Is there a better w...

How to get scripts to fire that are embedded in content retrieved via the jquery load() method?

I have found several other questions here on S.O. (and the web in general) that ask roughly this same question, but the answers always seem to suggest other ways of structuring code that avoid the need for addressing this underlying issue. For example, many people suggest (and a good suggestion, I agree) to put your code in the jquery l...