jquery

Event Binding - JQuery vs Javascript

What are the differences between using $("#element").click(function() { alert("test"); }); and <div id="element" onclick="alert('test');"></div> Is there any difference in performance, functionality or anything else? Should I be using jquery way, when I can simply use onclick attribute? ...

Javascript Array in Class = How to make it valid

I am using this jQuery validation library on my website. It requires me to put the validation rules in the class part of the input tag. ie <input class="validate[required,custom[onlyLetter],length[0,100]]" name="firstname" type="text" /> Now this causes me to end up with code in mine that looks similar such as: <input type="text" ...

jquery function problem

what's wrong with this code, first time I click the submit button it loads the iframe once, then clicking it again will load the iframe twice. and so on.. code: JS $(function() { $("form").submit(function() { // $("form").attr('target','myframe'); $('#myframe').load( function(){ alert('Hello'); }); });...

How can i make a friendfeed like window scroll control system?

When you active real-time updates, new entries dynamically adding a div. At this stage scroll is automatically moving. This action provides the content you do not miss on visible area. If you want to see this action, you can also watch this screencast; http://www.viddler.com/explore/itod/videos/45/ My method; // Firstly, i am ...

jQuery watch for domElement changes?

I have an ajax callback which injects html markup into a footer div. What I can't figure out is how to create a way to monitor the div for when it's contents change. Placing the layout logic I'm trying to create in the callback isn't an option as each method (callback and my layout div handler) shouldn't know about the other. Ideally I...

Upload multiple file with ajax, php, and jquery

Hi everyone, I am building an multiple file upload form that user can use to upload their pictures without being redirected to another page. The pseudo code as follow: 1. prompt user to create new album and redirect them to the addphoto.php page. 2. at the addphoto.php page user can pick their pictures to upload without going fu...

eclipse/netbeans: categorize/collapsing code?

is there someway you can categorize the code your are writing in these two programs. eg. if you have a function you can click the - sign on the left and it will collapse the function. but if i want to collapse a section of codes with some functions and procedural code, how can i do that? then you can have different "chapters" like in W...

$('#<%=nameLabel.ClientID%>') does not work when in .js file and works when in script is in the page.

$('#<%=nameLabel.ClientID%>') is being used in my script for jquery. When this is in ... block in tha page , it works fine ,as its a content page it is evaluated to $('#ctl00_contentPanel1_nameLabel') properly, i can see it while debugging scripts. however , when i keep the same script in .js file it does not evaulate to $('#ctl00_co...

how to insert a tr which is deleted from another table using jquery and ajax

I know how to remove a tr from the table1 on click of delete. But i want to insert it in to another table . How to do that? here is the code i used to remove the tr. <script languge="javascript" type="text/javascript"> $(document).ready(function() { $('a.delete').click(function(e) { e.preventDefault(); //Getting the TR to remov...

get center of width in all browsers with jquery

i have following code to get center of width function alertSize() { var myWidth = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in ...

Javascript classes and jQuery event listeners

Hi there, I'm writing a class that needs to attach event listeners to objects within a respective sections (#one and #two in this example), but I'm having issues passing variables from the class to set up the jQuery event listeners. <script type="text/javascript"> function myClass(id) { this.id = id; $(document).ready(funct...

log errors with stack trace in javascript

I'm trying to log javascript errors on a productive site. So far it worked quite well with the following code included in the site: function catcherr(errorMessage, url, line) { var parameters = "msg=" + escape(errorMessage) + "&url=" + escape(url) + "&line=" + escape(line); new Image().src = "/error.gif?...

all divs in my jquery code

I have 3 html box as follow: <div class="tabs"> <ul class="tabNav"> <li><a href="#video">Video Gallery</a></li> <li><a href="#photo">Photo Gallery</a></li> </ul> <div id="video"> video div </div> <div id="photo"> photo div </div> </div> <div class="tabs"> <ul class="tabNav"> <li><a href="#comment">comment</a></l...

using Jquery to automatically submit form

hi guys I am trying to submit a form by using jquery automatically after page load $(function(){ $("input[name=name]").val("somename"); $("input[name=email]").val("[email protected]"); $('#aweberform').submit(); }); Both the name/email value can be seen to get populated on the form. But the submit event wont triggered. Any one here that ...

getting a deeply nested css element with jquery

hello. I'm having troubles running an onchange event on a somewhat deeply nested form pulldown. So basically I have a form with an id of maxResultsForm inside a table with an id of listProductsResults inside another table with an id of listProductsSettings... with an id on the select tag of maxResults I've tried the below selector an...

Is there anyway to in jeditable to removing submit button when using select

Can you have a jeditable select that submits on selecting the dropdown (instead of needing the extra 'submit' ok button. ...

jquery.val() on the page works, off the page does not? Why?

I had the following: <script type="text/javascript"> var noteid = $('#noteid').val(); </script> <input type="hidden" name="noteid" id="noteid" value="321"> This works great... but now I'm trying to move the JavaScript off the page into a linked JS file like so: <script type="text/javascript" src="/js/note_beta.js"> </script> <input...

jquery executes too fast

I've got a bit of a problem with some jquery. The code works fine, but it's running too quickly, even inside of the whole $.document(ready) thing. Essentially, I have a layer of data loaded from a database - and then the .sortable is applied to it. The .sortable stuff is being applied before the HTML finishes drawing. Any ideas? The...

JQuery Combining Focus and Hover Events

Hey I am having a bit of trouble combining the HOVER and FOCUS events with jquery. This is what I had originally: $("input,textarea").focus(function () { $(this).parent().siblings('div.exp').removeClass('hide'); $(this).parent().siblings('div.exp').addClass('show'); }); $("input,textarea").blur(function (){ $(this).par...

Pass Parameter to JavaScript

I'm trying to pass two parameters to a JavaScript function. Unfortunately this give me error. Here is the function function load(do,div) { var do; var div; document.getElementById('spinner').innerHTML = '<img src=\'/images/spinner.gif\'>'; $('#'+div).load('rpc.php?'+do, function() ...