Search Results

Search found 17577 results on 704 pages for 'jquery tooltip'.

Page 53/704 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • Iterating changes using jQuery?

    - by HipHop-opatamus
    In the HTML below, I would like to copy the "submittedby" beside "message", within the H2 tag: <div class="comment"> <H2 class="threadtitle">Message 1</h2> <span class="submittedby">James</a> </div> <div class="comment"> <H2 class="threadtitle">Message 2</h2> <span class="submittedby">Bill</a> </div> <div class="comment"> <H2 class="threadtitle">Message 3</h2> <div class="submittedby">Phil</a> </div> My current jQuery code is as follows: $(document).ready(function() { $('.submittedby').copy().appendTo('.threadtitle'); }); The problem is this copies EVERY "submittedby" to EVERY "threadtitle". How do I code it so it only copies the "submittedby" from within the same "comment" div? Thanks!

    Read the article

  • jQuery Validate plugin - password check - minimum requirements - Regex

    - by QviXx
    I've got a little problem with my password-checker. There's got a registration form with some fields. I use jQuery Validate plugin to validate user-inputs. It all works except the password-validation: The password should meet some minimum requirements: minimum length: 8 - I just use 'minlength: 8' at least one lower-case character at least one digit Allowed Characters: A-Z a-z 0-9 @ * _ - . ! At the moment I use this code to validate the password: $.validator.addMethod("pwcheck", function(value, element) { return /^[A-Za-z0-9\d=!\-@._*]+$/.test(value); }); This Code works for the allowed characters but not for minimum requirements. I know that you can use for example (?=.*[a-z]) for a lower-case-requirement. But I just don't get it to work. If I add (?=.*[a-z]) the whole code doesn't work anymore. I need to know how to properly add the code to the existing one. Thank you for your answers! This is the complete code <script> $(function() { $("#regform").validate({ rules: { forename: { required: true }, surname: { required: true }, username: { required: true }, password: { required: true, pwcheck: true, minlength: 8 }, password2: { required: true, equalTo: "#password" }, mail1: { required: true, email: true }, mail2: { required: true, equalTo: "#mail1" } }, messages: { forename: { required: "Vornamen angeben" }, surname: { required: "Nachnamen angeben" }, username: { required: "Usernamen angeben" }, password: { required: "Passwort angeben", pwcheck: "Das Passwort entspricht nicht den Kriterien!", minlength: "Das Passwort entspricht nicht den Kriterien!" }, password2: { required: "Passwort wiederholen", equalTo: "Die Passwörter stimmen nicht überein" }, mail1: { required: "Mail-Adresse angeben", email: "ungültiges Mail-Format" }, mail2: { required: "Mail-Adresse wiederholen", equalTo: "Die Mail-Adressen stimmen nicht überein" } } }); $.validator.addMethod("pwcheck", function(value, element) { return /^[A-Za-z0-9\d=!\-@._*]+$/.test(value); }); }); </script>

    Read the article

  • Help with animating an element in jQuery

    - by alex
    I have an unordered list with a few list elements. #tags { width: 300px; height: 300px; position: relative; border: 1px solid red; list-style: none none; } #tags li { position: absolute; background: gray; } I have also started writing a jQuery plugin to animate the list elements. So far, I place the list elements randomly in the parent container, and choose a random font size for the text. My next step (which I am a bit stuck on) is to animate the list elements... essentially, I want the list elements to do something like this Slide from left to right whilst getting slightly larger up to the middle and then dropping in size back to normal when it hits the right border. Then, it should do the same in reverse, however it should also set a negative 'z-index' and maybe fade in opacity a bit. The first bit I'm really stuck on, is how to determine if the element is near the middle, in a way that I can have a value that starts at 0.1 on the far left hand size and is 1 in the middle and then back to 0.1 on the far right hand size. Basically, I want them to appear as if they are going around in a faux 3D circle into the page. Then I could do something like this $(this).css({ fontSize: percentageTowardsMiddle * 14, }); Do you know how I could do this? Thanks

    Read the article

  • jquery .submit live click runs more than once

    - by fxuser
    I use the following code to run my form ajax requests but when i use the live selector on a button i can see the ajax response fire 1 time, then if i re-try it 2 times, 3 times, 4 times and so on... I use .live because i also have a feature to add a post and that appears instantly so the user can remove it without refreshing the page... Then this leads to the above problem... using .click could solve this but it's not the ideal solution i'm looking for... jQuery.fn.postAjax = function(success_callback, show_confirm) { this.submit(function(e) { e.preventDefault(); if (show_confirm == true) { if (confirm('Are you sure you want to delete this item? You can\'t undo this.')) { $.post(this.action, $(this).serialize(), $.proxy(success_callback, this)); } } else { $.post(this.action, $(this).serialize(), $.proxy(success_callback, this)); } return false; }) return this; }; $(document).ready(function() { $(".delete_button").live('click', function() { $(this).parent().postAjax(function(data) { if (data.error == true) { } else { } }, true); }); });? EDIT: temporary solution is to change this.submit(function(e) { to this.unbind('submit').bind('submit',function(e) { the problem is how can i protect it for real because people who know how to use Firebug or the same tool on other browsers can easily alter my Javascript code and re-create the problem

    Read the article

  • jQuery date picker not persistant after AJAX

    - by ILMV
    So I'm using the jQuery date picker, and it works well. I am using AJAX to go and get some content, obviously when this new content is applied the bind is lost, I learnt about this last week and discovered about the .live() method. But how do I apply that to my date picker? Because this isn't an event therefore .live() won't be able to help... right? This is the code I'm using to bind the date picker to my input: $(".datefield").datepicker({showAnim:'fadeIn',dateFormat:'dd/mm/yy',changeMonth:true,changeYear:true}); I do not want to call this metho everytime my AJAX fires, as I want to keep that as generic as possible. Cheers :-) EDIT As @nick requested, below is my wrapper function got the ajax() method: var ajax_count = 0; function getElementContents(options) { if(options.type===null) { options.type="GET"; } if(options.data===null) { options.data={}; } if(options.url===null) { options.url='/'; } if(options.cache===null) { options.cace=false; } if(options.highlight===null || options.highlight===true) { options.highlight=true; } else { options.highlight=false; } $.ajax({ type: options.type, url: options.url, data: options.data, beforeSend: function() { /* if this is the first ajax call, block the screen */ if(++ajax_count==1) { $.blockUI({message:'Loading data, please wait'}); } }, success: function(responseText) { /* we want to perform different methods of assignment depending on the element type */ if($(options.target).is("input")) { $(options.target).val(responseText); } else { $(options.target).html(responseText); } /* fire change, fire highlight effect... only id highlight==true */ if(options.highlight===true) { $(options.target).trigger("change").effect("highlight",{},2000); } }, complete: function () { /* if all ajax requests have completed, unblock screen */ if(--ajax_count===0) { $.unblockUI(); } }, cache: options.cache, dataType: "html" }); } What about this solution, I have a rules.js which include all my initial bindings with the elements, if I were to put these in a function, then call that function on the success callback of the ajax method, that way I wouldn't be repeating code... Hmmm, thoughts please :D

    Read the article

  • jQuery UI slider coming out looking wierd

    - by jondavidjohn
    http://cl.ly/2W1V3s0G2G3y3D133I3U <--screenshot of rendered slider It acts normally by clicking the inner whitespace of the slider and dragging, values act accordingly, but the handles do not move and fill the area, and the line at the top grows/shrinks with the difference of the two values. Here is the code I am using to initiate the slider. $('.sliderific').each(function(){ alert($(this).attr('id')); $(this).slider({ range: true, min: 0, max: 500, values: [ 75, 300 ], slide: function( event, ui ) { $(this).nextAll('.left:first').text(ui.values[ 0 ]); $(this).nextAll('.right:first').text(ui.values[ 1 ]); } }); }); and here is the DOM it's being applied to... <div class="white notwide"> <div id="price-slider" class="sliderific"></div> <span class="em small gray left center">Min Price</span> <span class="em small gray right center">Max Price </span> </div> EDIT : Also, I have verified I am including the proper css and the jquery theme images are connecting and being loaded.

    Read the article

  • Javascript conversion, from Prototype to jQuery

    - by moshimoshi
    Hi, I would like to update the following javascript code based on Prototype framework to jQuery framework: Event.observe(window, 'load', function() { $$('.piece').each(function(item) { new Draggable(item, { revert: true } ); }); $$('.cell').each(function(item) { Droppables.add(item, { accept: 'piece', onDrop: function(piece, cell) { cell.descendants().each(function(item) { item.remove(); } ); piece.remove(); piece.setStyle({ 'top': null, 'left': null }); new Draggable(piece, { revert: true }); cell.appendChild(piece); } }); }); }); The first part of the script is easy to convert: $(function() { $('.piece').draggable( { evert: true } ); $('.cell').droppable( { /* But here, it's more difficult. Right? ;) ... */ } }); }); Have you got an idea? Any part of code is welcome. Thanks a lot.

    Read the article

  • JQuery Deferred - Adding to the Deferred contract

    - by MgSam
    I'm trying to add another asynchronous call to the contract of an existing Deferred before its state is set to success. Rather than try and explain this in English, see the following pseudo-code: $.when( $.ajax({ url: someUrl, data: data, async: true, success: function (data, textStatus, jqXhr) { console.log('Call 1 done.') jqXhr.pipe( $.ajax({ url: someUrl, data: data, async: true, success: function (data, textStatus, jqXhr) { console.log('Call 2 done.'); }, }) ); }, }), $.ajax({ url: someUrl, data: data, async: true, success: function (data, textStatus, jqXhr) { console.log('Call 3 done.'); }, }) ).then(function(){ console.log('All done!'); }); Basically, Call 2 is dependent on the results of Call 1. I want Call 1 and Call 3 to be executed in parallel. Once all 3 calls are complete, I want the All Done code to execute. My understanding is that Deferred.pipe() is supposed to chain another asynchronous call to the given deferred, but in practice, I always get Call 2 completing after All Done. Does anyone know how to get jQuery's Deferred to do what I want? Hopefully the solution doesn't involve ripping the code apart into chunks any further. Thanks for any help.

    Read the article

  • jQuery UI Datepicker - Disable specific days

    - by Sam
    Is there any (easy) way to set the jQuery UI Datepicker to disallow selection of specific, predetermined days? I was able to get this approach working, however, it produces a null error which prevents it from displaying in IE. 'natDays[...].0' is null or not an object Thanks in advance! UPDATE: Might help if I included some code, right? Anyway, most of this was taken straight from the aforementioned thread: natDays = [ [7, 23], [7, 24], [8, 13], [8, 14], ]; function nationalDays(date) { for (i = 0; i < natDays.length; i++) { if (date.getMonth() == natDays[i][0] - 1 && date.getDate() == natDays[i][1]) { return [false, natDays[i][2] + '_day']; } } return [true, '']; } function noWeekendsOrHolidays(date) { var noWeekend = $.datepicker.noWeekends(date); if (noWeekend[0]) { return nationalDays(date); } else { return noWeekend; } } $(function() { $("#datepicker").datepicker({ inline: true, minDate: new Date(2009, 6, 6), maxDate: new Date(2009, 7, 14), numberOfMonths: 2, hideIfNoPrevNext: true, beforeShowDay: $.datepicker.noWeekends, altField: '#alternate', }); }); Thanks again!

    Read the article

  • Authorization and Jquery dialog problem.

    - by bbrepols
    Hi, I have a little problem with a Jquery dialog for an action that requires a role. In my example, the user can click on a delete button and must confirm the action. In my controller, the Delete action requires a role, if the user is in the required role, the object is deleted. The problem: How to alert the user if * the element was deleted (redirect to the Index view) * there was an error (alert with the message) * he doesn't have the rights to delete (alert with the message) Before using the authorize filter, the delete action returned a JSON with a Boolean that indicates if there was an error, an URL to redirect on success and a message to alert on error. As I can't return a JSON from my filter, I created an other method with the authorize filter that returns a partial view with the confirm content. If the user doesn't have the rights, the filter returns a partial view with an unauthorized exception content. The problem: How to distinct which partial view was returned. When I create the dialog, I need to know for the buttons function. Thanks!

    Read the article

  • Load external pages using jquery

    - by user1688011
    I'm trying to use jquery to load external pages into the current without reloading. Apparently everything works fine except of one little issue, I hope I'll be clear as much as possible. When I call the page 'info.php' it is loaded into the #content div. That's what the script supposed to do, the problem is that in the main page, which contains the script and the #content div, I already have some code that I want it to be executed when someone visit the page and not to be called from external page. That is actually the case but when I click on one of the links in the menu, I can't go back to the initial content.. <script> $(function() { $('#nav a').click(function() { var page = $(this).attr('href'); $('#content').load(page + '.php'); return false; }); }); </script> <ul id="nav"> <li><a href="#">Page1</a></li> <li><a href="about">About</a></li> <li><a href="contact">Contact</a></li> <li><a href="info">Info</a></li> </ul> <div id="content"> Here I have some code that I wanted to be attributed to the "Page1" </div> Do you have any suggestions how to fix this issue? Thanks

    Read the article

  • How to display custom processing message in JQuery datatables

    - by Sukhi
    i am using datatables api to display data in my asp.net4.0 application; datatables I have one column [ Delete ] to delete the row data.when i click on this link i send a jquery ajax request to delete the row from database. I want to display a message such as [ Deleting record... ] to the end user until data deleted by server side processing. I put a div on my page and write a message [ Deleting record... ] in a div when i click on delete link i display that message but when delete operation complete it also display a message [ Processing... ](which is inbuilt message of datatables) which looks like odd as two message are displaying. What can i do better to display message to the end user. JSCode $('#tblVideoList .delete').live('click', function (e) { e.preventDefault(); var oTable = $('#tblVideoList').dataTable(); var aPos = oTable.fnGetPosition(this.parentNode); var aData = oTable.fnGetData(aPos[0]); if (confirm('Are you sure want to delete the record.')) { $("#divDelete").show(); var today = new Date(); $.ajax({ type: "GET", cache: false, url: "samplepage.aspx", success: function (msg) { $("#divDelete").hide(); oTable.fnDraw(); } }); } return false; }); Thanks

    Read the article

  • jQuery Validation: Validating Checkboxes with Different Names

    - by Michael
    I have a set of 4 checkboxes, all with different names, and require that at least 1 is checked. I know there are a few posts on here already trying to answer this question. The solution that seems to be most logical to me is the answer posted on Question 1734840, but I can't seem to get it working! What's wrong with my code? Or any other new coding ideas to get this working? I have set the class on all of them to 'require-one'. My jQuery code is $(document).ready(function(){ $("#itemForm").validate({ highlight: function(element, errorClass, validClass) { $(element).addClass(errorClass).removeClass(validClass); $(element.form).find("label[for=" + element.name + "]") .addClass("radioerror"); }, unhighlight: function(element, errorClass, validClass) { $(element).removeClass(errorClass).addClass(validClass); $(element.form).find("label[for=" + element.name + "]") .removeClass("radioerror"); }, rules: { 'require-one': { required : { depends: function(element) { var allBoxes = $('.require-one'); if (allBoxes.filter(':checked').length == 0) { if (allBoxes.eq(element).length != 0) { return true; } } return false; } } } , }, errorPlacement: function(error, element) { if ( element.is("#other_descrip") ) error.appendTo("#othererror" ); if ( element.is("#itemlist") ) error.appendTo("#itemerror" ); } }); });

    Read the article

  • N-son tabbed/JsScrollbar, trying to force gif play from click of link using jquery

    - by user314286
    Hello everyone, Let me start off by stating the obvious; I am new here. That said I hope I am not violating some standard I missed by posting this. xD For several days now I've been trying to update a rather old site of mine, to which I wont link to given that the update is so drastic that the current product on which I seek your help for doesn't resemble the old site in any other way then appearance. Anywho! I am using the tabbed div and JsScrollbar created by N-son (http://www.downloadjavascripts.com/list/javasitek60/Details.aspx) and so far have only used jquery to dynamically center content on the page. My problem however is this...I have a gif on the page that acts as a background (it's not tiled) and I'd like to be able to have it so that when you click on one of the links used in n-sons tabs (EX: news) it also causes the gif to load and play through itself once. So far all my attempts at accomplishing this myself have failed and break wither the scrollbar or prevent the content from switching when you click the tabs. (Except for one failed attempt where it all worked fine except the handle for the scrollbar would vanish upon switching tabs) I hope I've been clear in this and that someone is able to help. I know it may seem like a silly question but we're all new at some point. :P If need be I'll upload what coding I have but it is not pretty. Thank you in advance.

    Read the article

  • JQuery load help

    - by mtwallet
    Hi. I am trying to use load() to place some html into a div on a page. I have a bunch of links like this: <div id="slideshow"> <div id="slides"> <div class="projects"> <a href="work/mobus.html" title="Mobus Fabrics Website"> <img src="images/work/mobus.jpg" alt="Mobus Fabrics Website" width="280" height="100" /> </a> <a href="work/eglin.html" title="Eglin Ltd Website"> <img src="images/work/eglin.jpg" alt="Eglin Ltd Website" width="280" height="100" /> </a> <a href="work/first-brands.html" title="First Brands Website"> <img src="images/work/first-brands.jpg" alt="First Brands Website" width="280" height="100" /> </a> </div> <a id="prev"></a> <a id="next"></a> </div> and my jquery code looks like this: $('.projects a').click(function() { $('#work').load(this.href); }); The problem is when clicked the html is placed in the #work div the html is loaded in another page. Please can anyone help?

    Read the article

  • jQuery modal dialog on ajaxStart event

    - by bdl
    I'm trying to use a jQuery UI modal dialog as a loading indicator via the ajaxStart, ajaxStop / ajaxComplete events. When the page fires, an Ajax handler loads some data, and the modal dialog shows just fine. However, it never hides or closes the dialog when the Ajax event is complete. It's a very small bit of code from the local server that is returned, so the actual Ajax event is very quick. Here's my actual code for the modal div: $("#modalwindow").dialog({ modal: true, height: 50, width: 200, zIndex: 999, resizable: false, title: "Please wait..." }) .bind("ajaxStart", function(){ $(this).show(); }) .bind("ajaxStop", function(){ $(this).hide(); }); The Ajax event is just a plain vanilla $.ajax({}) GET method call. Based on some searching here and Google, I've tried altering the ajaxStop handler to use $("#modalwindow").close(), $("#modalwindow").destroy(), etc. (#modalwindow referred to here as to give explicit context). I've also tried using the standard $("#modalwindow").dialog({}).ajaxStart(... as well. Should I be binding the events to a different object? Or calling them from within the $.ajax() complete event? I should mention, I'm testing on the latest IE8, FF 3.6 and Chrome. All have the same / effect.

    Read the article

  • JQuery submit form and output response or error message

    - by sergdev
    I want to submit form and show message about result. update_records initializes alert_message to error message. If success I expect that its value is changed. Than update_records outputs message. But the function always alerts "Error submitting form". What is wrong with this? The code follows: function update_records(form_name) { var options = { async: false, alert_message: "Error submitting form", success: function(message) { this.alert_message = message; } }; $('#' + form_name).ajaxSubmit(options); alert(options.alert_message); } I am newbie in Javascript/JSon/Jquery and I suspect that I misunderstand some basics of mentioned technologies. UPDATE: I specified "async:false" to make execution synchronous (Is it correct?) I also tried to insert delay between following two lines: $('#' + form_name).ajaxSubmit(options); pausecomp(1000); // inserted pause alert(options.alert_message); It also does not resolve the issue Function fo pousecomp follows: function pausecomp(millis) { var date = new Date(); var curDate = null; do { curDate = new Date(); } while(curDate-date < millis); }

    Read the article

  • JQuery Dragging Outside Parent

    - by Andy
    I'm using JQuery's draggable(); to make li elements draggable. The only problem is when the element is dragged outside its parent, it doesn't show up. That is, it doesn't leave the confines of its parent div. An example is here: http://imgur.com/N2N1L.png - it's as if the z-index for everything else has greater priority (and the element slides under everything). Here's the code: $('.photoList li').draggable({ distance: 20, snap: theVoteBar, revert: true, containment: 'document' }); And the li elements are placed in DIVs like this: <div class="coda-slider preload" id="coda-slider-1"> <div class="panel"> <div class="panel-wrapper"> <h2 class="title" style="display:none;">Page 1</h2> <ul class="photoList"> <li> <img class="ui-widget-content" src="photos/1.jpg" style="width:100px;height:100px;" /> </li> </ul> </div> </div> I'm positive the problem is it won't leave its parent container, but I'm not sure what to do to get it out. Any direction or help would be appreciated GREATLY!

    Read the article

  • jquery change event not working with IE6

    - by manivineet
    It is indeed quite unfortunate that my client still uses IE6. using jquery 1.4.2 The problem is that I open a window using a click event and do some edit operation in the new window. I have a 'change' event attached to the row of a table which has input fields. Now when the window loads for the first time and I make a change in the input for the FIRST time, the change event does not fire. however, on a second try it starts working. I have noticed that I e.g. I run a dummy page, i.e. create a new page(i work with visual studio) and run that page individually , the 'change' event works just fine. what it going on? and what can i do, besides going back to 1.3.2 (by the way that doesn't work either, but haven't fully tested it yet) <!--HTML--> <table id="tbReadData"> <tr class="nenDataRow" id="nenDr2"> <td> <input type="text" class="nenMeterRegister" value="1234" /> </td> <tr /> <table> <script type="text/javascript"> $(document).ready(function(){ $('#tbReadData').find('tr').change(function() { alert('this works'); } }); </script>

    Read the article

  • Preserve whitespace and formatting for text returned from $.get jquery call

    - by desigeek
    I have a jquery $.get() call in my app that requests an entire web page. In the callback function, I access a div in the returned page, get its data and show it on my page. The problem is that the text I get from the div does not preserve the source formatting. If the div in the requested page had say an ordered list, then when i get that text and display on my page, it shows up as a paragraph with items inline instead of being shown as a list. I do not know whether the problem is how $.get() is getting the data or in my displaying of the data. //get the page $.get($(this).attr('href'), function(data){ callbackFunc(data,myLink); }, "html"); function callbackFunc(responseText, customData){ //response has bg color of #DFDFDF var td = $("td[bgcolor='#DFDFDF']", responseText); //text to show is in div of that td var forumText = $('div', td).text(); //append new row with request data below the current row in my table var currentRow = $(customData).parent('td').parent('tr'); var toAppend = "<tr><td class='myTd' colspan='3'>" + forumText + "</td></tr>"; $(currentRow).after(toAppend); } The response data shows up like ABC in the new row I add to my div while the source page div had A B C I should add that this script is part of an extension for Google Chrome so that is my only browser that I have tested on

    Read the article

  • Getting jQuery datepicker to attach to a TextBox within a ListView

    - by Clay
    I am using the jQuery Datepicker without any problem for TextBox controls that are non-templated. However, I am unable to get the datepicker to work with a TextBox that is in an EditItemTemplate of a ListView control. My latest attempt is to get a handle on this textbox by CSS class name "DateControl", any ideas? <asp:ListVIew id="lvTest" runat="server"> <LayoutTemplate>...</LayoutTemplate> <ItemTemplate>...</ItemTemplate> <EditItemTemplate> <tr> <td> <asp:TextBox ID="txtExpReceiveDate" runat="server" Text='<%#Eval("exp_receive_date","{0:dd-MMM-yy}") %>' CssClass="DateControl" /> </td> </tr> </EditTemplate> </asp:ListView> <script type="text/javascript" language="javascript"> $(document).ready(function () { $('DateControl').datepick({ dateFormat: 'M-dd-yyyy' }); }); </script>

    Read the article

  • jQuery Dialog - Remote Page Javascript not running in FF / Chrome

    - by Robert
    Hey SO, I've created a page intended only to be opened via modal. This page contains a calendar of the User's favorite events...etc. I'm using the jQuery Dialog and FullCalendar plugins to do this. In IE, there is not issue...everything works fine. However, the Javascript on the remote page (Calendar.aspx) is never getting executed in FF or Chrome. Here's my code. SomeRandomPage.aspx $("#showcalendar").click(function() { var dialog = $('<div style="display:hidden"></div>').appendTo('body'); // load remote content dialog.load("Calendar.aspx", {}, function(responseText, textStatus, XMLHttpRequest) { dialog.dialog( { modal: true, width: 750, resizable: false, draggable: false, title: "My Calendar", closeOnEscape: false, close: function(event, ui) { $(this).remove(); } } ); }); }); } Calendar.aspx <!-- Necessary js above --> <div id="calendar"></div> <script> $(document).ready(function() { alert("HERE"); //Doesn't work in FF or Chrome. Works in IE $('#calendar').fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month' }, editable: false, events: '/webservices/CalendarEvents.ashx' }); }); </script>

    Read the article

  • jQuery validation with submit handler

    - by James
    I setup the form validation using jQuery validation plug-in's validate method and I have a submit handler that modifies the input element's value (I use YUI editor and it needs saveHTML() call to copy the iframe's content to the textarea element.). When submitting the form, I want the validator to validate the form after executing my submit handler. But it doesn't execute my submit handler if it is registered after the validate call. For example, <form id="form1" action="/test"> <input type="text" name="txt1" id="txt1" /> <input type="submit" value="submit" /> $(document).ready(function() { $("#form1").submit(function() { $("#txt1").val("123456"); }); $("#form1").validate({ rules: { txt1: { maxlength: 5 } } }); }); The form is validated after my submit handler so submit is canceled. $(document).ready(function() { $("#form1").validate({ rules: { txt1: { maxlength: 5 } } }); $("#form1").submit(function() { $("#txt1").val("123456"); }); }); However if I change the order the form is validated before my submit handler.

    Read the article

  • jquery selecting all elements except the last per group

    - by Anthony
    I have a table that looks like: <table> <tr> <td>one</td><td>two</td><td>three</td><td>last</td> </tr> <tr> <td>blue</td><td>red</td><td>green</td><td>last</td> </tr> <tr> <td>Monday</td><td>Tuesday</td><td>Wednesday</td><td>last</td> </tr> </table> What I want is a jquery selector that will choose all but the last td of each table row. I tried: $("tr td:not(:last)").css("background-color","red"); //changing color just as a test... But instead of all cells but the last on each row being changed, all cells but the very last one in the table are selected. Similarly, if I change it to: $("tr td:last").css("background-color","red"); the only one that changes is the very last cell. How do I choose the last (or not last) of each row?

    Read the article

  • Howto serialize multiple Lists with Jquery

    - by megens
    I have 3 sortable UL's and a simple jquery/javascript <ul class="sortable" id="menu1"> <li id="id_1">whatever</li> <li id="id_2">you</li> </ul> <ul class="sortable" id="menu2"> <li id="id_3">wanne</li> <li id="id_4">put</li> </ul> <ul class="sortable" id="menu3"> <li id="id_5">in</li> <li id="id_6">here</li> </ul> $(function() { $("ul.sortable").sortable({ connectWith: 'ul' }); }); </script> LI's are draggable between UL's How can i serialize this so i get for example menu1[0]=1&menu1[1]=3 Or and array or whatever i can work with to save the state?

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >