jquery

How do I learn if events are bound to an element using jquery?

I need a hasEvents() method like var someBool = hasEvents($("#myelement")); that returns true if there are some bound events to any of the element's event handlers. ...

How do I determine height and scrolling position of window in jQuery?

I need to grab the height of the window and the scrolling offset in jQuery, but I haven't had any luck finding this in the jQuery docs or Google. I'm 90% certain there's a way to access height and scrollTop for an element (presumably including the window), but I just can't find the specific reference. Any help is appreciated! Thanks! ...

jQuery: Select <a> which href contains some string

Hi, Is it possible using jQuery to select all <a> links which href ends with "ABC" for example, if i want to find this link <a href="http://server/page.aspx?id=ABC"&gt; Thanks in advance ...

jQuery - cycle help

I'm looking to get some help on using the cycle library for jQuery. I'm in the beginner demos, and I got the absolute first one completed. This is the second one on the page. <script src="jquery-1.2.6.min.js" type="text/javascript"></script> <script src="jquery.cycle.all.min.js" type="text/javascript"></script> <script type="text/javasc...

What is the easiest way to order a <UL>/<OL> in jQuery?

I'm looking for some sample code that will sort the list items in an HTML list by alphabetical order. Can anyone help? Here is a sample list for people to work with: <ul class="alphaList"> <li>apples</li> <li>cats</li> <li>bears</li> </ul> ...

How to send serialize form data using JQuery if the input element is an array

I have this piece of code in my PHP code: while ($row = mysqli_fetch_assoc($result)) { extract($row); echo "<tr>"; echo "<td bgcolor='#FFFFFF'><input id='bookArray[]' name='bookArray[]' type='checkbox' value='$book_id' />$book_id</td>"; echo "<td bgcolor='#FFFFFF'>$threat_name</td>"; echo "</tr>"; } In HTML page, I...

jQuery Autocomplete and ASP.NET

I searched all over this site and the web for a good and simple example of autocomplete using jQuery and ASP.NET. I wanted to expose the data used by autocomplete with a webservice (and will probably do that next). In the meantime, I got this working, but it seems a little hacky... In my page I have a text box: <input id="txtSearch" ty...

Modifying the style attributes of selected table cells with jQuery?

I'm building a pretty basic HTML table creator/editor (based on a designMode iframe) at work, using direct DOM manipulation. It's a pain, obviously due to Internet Explorer. When in designMode, a table inserted into the editing area iframe is resizable and the contents of the cells can be freely edited. In Firefox, rows and columns can ...

$(this) selector and children?

I'd like to use a selector to select the child img of the div I'm clicking on this example: <div id="..."><img src="..."></div> To get the div, I've got this selector: $(this) How do I get the img with a selector? ...

How do I connect multiple sortable lists to each other in jQuery UI?

I'm new to jQuery, and I'm totally struggling with using jQuery UI's sortable. I'm trying to put together a page to facilitate grouping and ordering of items. My page has a list of groups, and each group contains a list of items. I want to allow users to be able to do the following: 1. Reorder the groups 2. Reorder the items within the...

JavaScript Libraries - Side-by-Side Comparisons

Microsoft recently announced that they were endorsing jQuery as an "officially" supported JavaScript library. I certainly wouldn't argue that jQuery is a fantastic framework to work with. In fact, I just bought the book. But I'm curious to know why. Specifically, I'm interested to know whether or not we web developers can expect jQue...

How do I select a single element in jQuery?

I have a table structure that looks like: <table> <tr id="row1"> <td> <div>row 1 content1</div> </td> <td> <div>row 1 content2</div> </td> <td> <div>row 1 content3</div> </td> </tr> <tr id="row2"> <td> <div>row 2 content1</div> </td> <td> <div>row 2 content2</div> </td> <td> ...

Using jQuery, Restricting File Size Before Uploading

On PHP, they have a way to restrict file size AFTER uploading, but not BEFORE uploading. I use the Malsup jQuery Form Plugin for my form posting, and it supports image file posting. I was wondering if perhaps there's a restriction where I can set how many bytes can pass through that AJAX stream up to the server? That could permit me to ...

How do I use the value of a variable at declaration time in a JavaScript anonymous function?

Hi, This is a really basic question but... I have some code like this var arr = Array('blah.jpg','ha.jpg'); for (var i=0; i<array.length; i++) { $('div#blah' + i).click(function() { $('img').attr('src', arr[i]); }); } This should bind the div with id="blah0" to change all images to 'blah.jpg' when clicked. Similarly, ...

jQuery draggable table elements

jQuery's draggable functionality doesn't seem to work on tables (in FF3 or Safari). It's kind of difficult to envision how this would work, so it's not really surprising that it doesn't. <html> <style type='text/css'> div.table { display: table; } div.row { display: table-row; } div.cell { display: table-cell; } </style>...

jQuery slideUp().remove() doesn't seem to show the slideUp animation before remove occurs

I have this line of JavaScript and the behavior I am seeing is that the selectedLi instantly disappears without "sliding up". This is not the behavior that I expected. What should I be doing so that the selectedLi slides up before it is removed? selectedLi.slideUp("normal").remove(); ...

jQuery Graceful Degradation

I want to spruce up some areas of my website with a few jQuery animations here and there, and I'm looking to replace my AJAX code entirely since my existing code is having some cross-browser compatibility issues. However, since jQuery is a JavaScript library, I'm worried about my pages not functioning correctly when JavaScript is turned ...

Javascript "onMouseOver" triggering for children?

I can't tell if this is a result of the jQuery I'm using, but this is what I'm trying to do: <div class="info" style="display: inline;" onMouseOut="$(this).children('div').hide('normal');" onMouseOver="$(this).children('div').show('normal');" > <img src="images/target.png"> <div class="tooltiptwo" id="tooltip" style="font...

Reading the selected value from asp:RadioButtonList using jQuery

I've got code similar to the following... <p><label>Do you have buffet facilities?</label> <asp:RadioButtonList ID="blnBuffetMealFacilities:chk" runat="server"> <asp:ListItem Text="Yes" Value="1"></asp:ListItem> <asp:ListItem Text="No" Value="0"></asp:ListItem> </asp:RadioButtonList></p> <div id="HasBuffet"> <p><label>What...

Jquery - How do I fix this Image Rollover?

Hi Guys I have this little Jquery script: link text $(document).ready(function() { $('#image p').hide(); $('img').hover(function() { $('#image p').show(200); }, function() { $('#image p').hide(200); }); }); I works fine, but I want to be able to hover over the Text locate...