jquery

Identify HTML block elements in jQuery

I have simple one column HTML files (ebooks from Gutenberg Project). I want to identify in the DOM the block elements (like <h1> <p> <div> <table> etc, not <a> <em> <b> etc) and enclose them in <div> tags. Is there any easy way to do it in jQuery? Thanks ...

jquery using object literal over multiple files

I've seen object literal examples and they look really nice and sensible. What I want to know is if it's possible to use object literal over multiple files, because all the examples I've seen had only 1 file. Thanks. ...

Preloading images before webpage loads

Hello, it's my 1st question here, so pardon if something is asked wrong :) I want to preload 3 images before webpage is loaded so all of them would appear in the same moment. Right now images are loaded one after another and it looks kinda choppy. One image is defined in css (), other two are plain simple "img" element. I've tried crea...

Jquery: Turn 3 arrays in to different objects with different IDs

I've been fooling around with a very minimalistic jquery admin area menu. The thing is I want jQuery to build 3 equal menus with different ID's. I managed to do this by creating a function and call it 3 times with different variables, but I'd like to ask my first question on this lovely community: What is the most minimalistic and effic...

how to stop callback until Animations in ajax beforeSend event have completed?

I am using slideUp and slideDown in the beforeSend ajax event which works fine is firefox, but in other browsers, the ajax postback seems to complete before the slideUpDown has completed so my success function is executed first, then the slideUp/Down. How can I change it to either (1) not send the ajax until the slideUp/Down have comple...

How to parse JSONP data returned from remote server

I am trying to grab some data via JSONP. Using Firebug, I am able to see the data properly being returned, but I am having a hard time thinking how I have to parse it. The data return is really a nested array correct? someFunction is the name of the callback function. This is how the data looks: someFunction([ { "title":"Sa...

Delete link with jquery confirm in Asp.Net MVC 2 application

I have a table with records that has delete links. Basically I followed the NerdDinner tutorial for that part in MVC. But I don't want to have the confirm view, I'd rather have a confirm dialog, and then if confirmed let the HttPost action method delete the record directly. I have something working, but being new to both MVC and jQuery,...

jQuery ui dialog image for the title

Is it possible when specifying a jQuery UI dialog box, to have an image be placed for my title instead of just plain text? Thanks ...

jquery load/unload content

I'm doing my first project with jquery: My site will have some tabs: 1. I've got a list which will be the tabbar. 2. I've got a lot of content-container-divs which I hide() / show() depending on which tab I clicked. My question/s: Should I load() unload these divs, even if they are in the same html ? (on jquery-docs they load from ex...

Close <p> tags in jQuery

I have a large html file of a story. The <p> tags are not closed, for example: <p> First paragraph <p> Second paragraph I would like to have a proper XHTML document: <p> First paragraph</p> <p> Second paragraph</p> Can I achieve this with jQuery? Thanks ...

Most basic javascript templating solution...?

I am looking to create a variable that is a template for repatative elements of my site. I however am only using it infrequently so I do not wish to use a javascript templating engine or library. I am using jquery... if that effects anyones approach. This is one of my templates. $html_template = json_encode(" var html = '<a href=\"jav...

JQtouch image linking

Hello, I'm trying to enable functionality in my web app to allow users to click on the company's logo to link back to the main page of the web app using JQtouch. With my current code, I'm getting the an error in the web inspector saying that there are "No pages in the history" when I click on the image. Here is an example: <a href="#m...

jQuery input value

We have some input elements on the page: <input type="text" class="lovely-input" name="number" value="" /> User types a number he wants to see. How to watch for this input value. with some options? They are: If user types a digit more than 100, change the value of input (on fly, without page refresh) to 100. If he types digit less ...

Checking if file exists using $.ajax() problem

I am having a problem checking if a file exists using $.ajax(). I am looping through a json file with $.each and I want to see if the specified staff member has an image, and if not use the no_photo.jpg image. I keep getting the no_photo.jpg image even though there is the staff member's image in the directory. Here is the entire $.getJS...

turn this into a jquery function?

I am using the code below to do pagination on a table (please do not suggest any prebuilt ones) function tablejax(url, start, count) { $('#tablejaxButton').attr("disabled", "true"); $('#tablejaxOverlay').fadeIn('slow'); $.ajax({ type: "GET", url: url, data: "start="+start+"&count="+count+"&identifier=...

client side validation on dynamic elements

I have a form that a user can click a button to add another set of inputs. So I am using eName[] for example. I was hoping to use jquery to do this, and thought live() would be a great way to loop through all the elements the user created to see if they are blank but I am not sure if I can do this without binding to an event. So I am thi...

Javascript Json inside loop

Hello, I am trying to execute a loop with a JSON query inside it. My code looks something like: for (var i = 0; i < numitems; i++) { var currentitem = items[i]; $.getJSON("http://localhost/items.php", {'itemname' : currentitem}, function (json) { alert (json); }); } But it seems like the for loop doesn't wait for th...

How to toggle text in progressive disclosure script?

I have a small progressive disclosure ("text expand and collapse") but the toggle text doesn't change. Works like this: ( and I didn't write it) $(document).ready(function() { $('div.view').hide(); $('div.slide').toggle( function() { $(this).siblings('div.view').fadeIn('slow'); }, function() ...

Most correct way to select option in <select> box

I know there are multiple ways to select a particular option from a using jQuery: $select.val("someValue") $option.attr("selected", "selected") $select[0].selectedIndex = 1 Assuming you have both the index of the option you wish to be selected and its value, what's the most correct way (from the above, or otherwise) to make it selec...

jQuery - Hide a div menu after clicking outside div

I've build a drop down menu at: http://www.ourbridalsongs.com/new_header/header.php When you click on the up/down arrow next to the logo - the menu appears - I'd like to make it disappear when clicking anywhere else on the screen - for some reason it's getting stuck and doesn't slide back up. Can anyone help resolve this! Here's my s...