Search Results

Search found 17637 results on 706 pages for 'jquery autocomplete'.

Page 13/706 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • JQuery - Ajax saving sortables in connected lists when sortable item is moved

    - by Ben Sinclair
    I have multiple JQuery sortable lists that connect with each other... They allow you to assign users to certain roles. Basically what I want to do is when a user is dragged from one list to another, I want JQuery to pick up the first list that the user was moved from so that I can send an AJAX request to delete it from that list in my database. I tried the following but every time you move the user over a list and haven't even dropped it within a list, it sends this request which means I'll be sending multiple AJAX requests... Does that make sense? $( ".selector" ).sortable({ out: function(event, ui) { ... } }); From my testing, I can use the following code to just update the list that user has been moved to so I've got the second half covered: $( ".selector" ).sortable({ receive: function(event, ui) { ... } }); Hopefully I am making sense :)

    Read the article

  • How to attach to the jQuery Autocomplete plugin's mouse events?

    - by Tommy B
    My problem is this: I need to update some text in a div with the value of what the mouse pointer is hovering over in the autocomplete drop down list. Can it be done easily, or do I have to make fundamental changes to the Autocomplete plugin? I am using the jQuery Autocomplete plugin version 1.1 by Jörn Zaefferer. Any and all help will be greatly appreciated!

    Read the article

  • can you explain this jquery method from jquery.js

    - by mrblah
    Trying to understand how jquery works under the covers, what's the difference between: jQuery.fn and jQuery.prototype jQuery = window.jQuery = window.$ = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context ); }, and then: jQuery.fn = jQuery.prototype = { init: function( selector, context ) {

    Read the article

  • JQuery UI Dialog query dialog DOM

    - by Travis
    The following simply loads a jquery-ui dialog from an external html file. $('#showdialog').click(function(e) { var div = $('<div>loading...</div>'); div.dialog({ modal: true, open: function() { div.load('anotherpage.html'); } }); e.preventDefault(); }); After the DOM loads from the external html file, I'd like to interrogate it with JQuery. For example, supposing anothorpage.html had a bunch of anchors on it, I'd like to wire up click handlers for them when it loads into the dialog. Any ideas?

    Read the article

  • Jquery mouseover event issues

    - by Shaun
    Hi I am currently working on a project where I am using jQuery to animate a block of text on mouse over. The event listener is on the containing div (as shown by the code below) and works really well until the mouse is over the title (.views-field-title) which is absolutely above the containing div. The animation begins to jump almost as though it is starting over? What am I doing wrong? $('#interior_design .views-row').mouseover(function(){ $('.views-field-title', this).stop(true, true).animate( { height: '+=10px' }, { duration: 'fast'}); }); $('#interior_design .views-row').mouseout(function(){ $('.views-field-title', this).stop(true, true).animate( { height: '-=10px' }, { duration: 'fast'}); }); Link to dev server: http://viva.bangtest.co.uk/interior-design Note: this site is still in development as such the jQuery is only on the above linked page currently. I'm open to all suggestions.

    Read the article

  • jQuery droppable accordion

    - by awshepard
    I've been playing around with trying to create a droppable accordion for a little while, and haven't gotten it to be very responsive. When I drag an item over the accordion, it takes 5+ seconds for the accordion element to open (if it does at all). Sometimes I have to "wave" the dragged element over the accordion element. I know I read something a while back about event processing in javascript - something along the lines of the browser not always passing control to the javascript engine when you think it does, or something like that, resulting in weird timing. Has anyone else seen tried to do this before? Have you found jquery/javascript to be this slow? Do you have any references for how to get a responsive droppable accordion (the jQuery UI site doesn't seem to, and I didn't find anything on SO or Google). Thanks!

    Read the article

  • jQuery: jquery form plugin syntax?

    - by k00k
    I'm using jquery with the jquery form plugin. I read through a bunch of posts, the docs, etc., and I'm still having trouble with what I believe to be simple. I have a form with some simple text inputs and a couple textareas, and I have this link that I want to trigger submission of that form to a specific method (/email): <a id="email-data">Send Email</a> and this jquery in doc ready: $('#email-data').click(function() { var options = { url: '/email/', success: alert('Email sent.') }; $('#report-giftcard-sales-form').ajaxSubmit(options); }); So I would expect it to submit to my /email method, but no such luck. Currently I just have the /email method logging a debug message, so it's as simple as can be. Any help is greatly appreciated.

    Read the article

  • How can I check if a particular jQuery UI function is available and use a different function if it i

    - by Mark B
    I'm writing a jQuery plugin and I would like my code to take advantage of the jQuery UI show(effect, [options], [speed], [callback]) and hide(effect, [options], [speed], [callback]) functions, which allow you to show and hide elements with a nice animation. However, I'd also like my plugin to degrade gracefully if jQuery UI isn't available, switching back to use the basic, non-animating show() and hide() functions present in the standard jQuery API. I'll need to test for the show and hide functions specifically, as even if jQuery UI is available it could potentially be a custom version, without the Effects components included. At first I thought that I might be able to do something like: if(typeof myelement.show('blind', 'slow') == 'undefined') { myelement.show('blind', 'slow'); } else { myelement.show(); } But of course this doesn't work, as even if UI isn't present, show() is still a function, it just has a different signature—so typeof returns object in either case. So, what's the best way for me to check if jQuery UI is available to my plugin? Any help is much appreciated!

    Read the article

  • Combinig JQuery datapicker with input field validation /filter

    - by Olav
    I am using the JQueryui Datepicker. But it doesn't really affect values entered manually in the input-field. Is there some way I can use the same (client) code to specify mask / validation on the input field (when the datapicker is not used - not just have datepicker output the correct format). What would be the most consistent way to do this in the JQuery framework? Thanks Remarks It seems jQuery put som restraints on input (I.e. I can only enter digits- mask "yymmdd") so the main thing is to get validation.

    Read the article

  • Geocoding autocomplete bias not working

    - by chris
    I'm using the following code to get the autocomplete functionality for an address input box using Google Maps API v3: function initializeAutocomplete() { var defaultBounds = new google.maps.LatLngBounds( new google.maps.LatLng(1.484016,103.575212), new google.maps.LatLng(1.233592,104.033618)); var input = document.getElementById('destStreet'); var myOptions = {bounds: defaultBounds, types: ['geocode']}; autocomplete = new google.maps.places.Autocomplete(input, myOptions); } The problem is that biasing doesn't seem to work as the first results are usually not relevant to the defined bounds (a country). I've seen a few apps working fine, so I'm wondering where the problem is. I came across the JQuery autocomplete plugin (http://code.google.com/p/geo-autocomplete/) which would seem like a good alternative since it has a region filter, but I'm unable to "install it" or use it because of my very limited knowledge (I learn by example). Could you please help me getting more relevant results with the above code or guide me through the implementation of the JQuery alternative? Of course I'm very open to other suggestions as well.

    Read the article

  • clicking anchor element within jquery tab loads new page *outside* tab

    - by tabs_newbie
    Hello, I would like to be able to click on an achor element from a page inside a jQuery tab and have that new page load directly inside the original tab. I used sample code from the jQuery tutorial page but to no avail! When I click on the anchor tag, I get redirected to www.google.com but lose my tabs. Does anyone know what I'm doing wrong? would really appreciate it. Thanks! $(document).ready(function(){ $("#tabs").tabs(); }); $('#tabs').tabs({ load: function(e, ui) { $('a', ui.panel).click(function() { $(ui.panel).load(this.href); return false; }); } });

    Read the article

  • jQuery autocomplete works with a local string but not when the same String is called off the server

    - by Ankur
    This is related to the question I asked at http://stackoverflow.com/questions/2802948/how-to-make-an-ajax-call-immediately-on-document-loading My code is: $(document).ready(function(){ $.ajax({ type: "GET", url: "../AutoComplete", success: function(data) { var dataArray = data; alert(dataArray); $("#example").autocomplete(dataArray); } }); }); The value that is printed in the alert is: "Manuscript|Text|Information Object|Basketball|Ball|Sporting Equipment|Tarantula|Spider|Australian Spider|Cricket Player|Medieval Artefact|Person|Sportsperson|Leonardo Da Vinci|Country|Language|Inventor|Priest|Electronics Manufacturer|Object|letter|Artefact|governance model|Organism|Animal".split("|"); If instead I do this: $(document).ready(function(){ $.ajax({ type: "GET", url: "../AutoComplete", success: function(data) { var dataArray = "Manuscript|Text|Information Object|Basketball|Ball|Sporting Equipment|Tarantula|Spider|Australian Spider|Cricket Player|Medieval Artefact|Person|Sportsperson|Leonardo Da Vinci|Country|Language|Inventor|Priest|Electronics Manufacturer|Object|letter|Artefact|governance model|Organism|Animal".split("|"); alert(dataArray); $("#example").autocomplete(dataArray); } }); }); It works fine?

    Read the article

  • jquery autocomplete, $array source. how do i make it multiple?

    - by Toni Michel Caubet
    hello there! I'm using autocomplete so user can easly enter data on inputs, like this: <? $a = new etiqueta(0, ''); $b = $a->autocomplete_etiquetas(); ?> <script type="text/javascript"> function cargar_autocomplete_etiquetas(){ $("#tags").autocomplete({ source: [<? echo $b; ?>] }); } </script> $a = $b its an array with a result like: 'help','please',i','need','to,'be able to', 'select next item',' with autocomplete'; and i checked the ui documentation, but it doesn't fith with my source method.. any idea? I'm trying like this (edited with Bugai13 aportation): <? $a = new etiqueta(0, ''); $b = $a->autocomplete_etiquetas(); ?> <script type="text/javascript"> function cargar_autocomplete_etiquetas(){ $("#tags").autocomplete({ source: [<? echo $b; ?>], multiple: true, multipleSeparator: ", ", matchContains: true }); } </script> but i don't know how to do it.. any idea? are .push and .pop functions from the autocomplete? or shall i define, them? thanks again! PS: i'm getting adicted to this site! PS: come on dudes, i think the answer will be very usefull for many people PS: is it allowed to offer paypal reward?

    Read the article

  • jquery autocomplete: works for first value, how to enable it for next?

    - by Toni Michel Caubet
    hello there! I'm using autocomplete so user can easly enter data on inputs, like this: <? $a = new etiqueta(0, ''); $b = $a->autocomplete_etiquetas(); ?> <script type="text/javascript"> function cargar_autocomplete_etiquetas(){ $("#tags").autocomplete({ source: [<? echo $b; ?>] }); } </script> $a = $b its an array with a result like: 'help','please',i','need','to,'be able to', 'select next item',' with autocomplete'; and i checked the ui documentation, but it doesn't fith with my source method.. any idea? I'm trying like this (edited with Bugai13 aportation): <? $a = new etiqueta(0, ''); $b = $a->autocomplete_etiquetas(); ?> <script type="text/javascript"> function cargar_autocomplete_etiquetas(){ $("#tags").autocomplete({ source: [<? echo $b; ?>], multiple: true, multipleSeparator: ", ", matchContains: true }); } </script> but i don't know how to do it.. any idea? are .push and .pop functions from the autocomplete? or shall i define, them? thanks again! PS: i'm getting adicted to this site! PS: come on dudes, i think the answer will be very usefull for many people PS: is it allowed to offer paypal reward?

    Read the article

  • jQuery UI Element vs Dojo (Dijit) Form Element

    - by Muers
    Dojo seems to have a useful feature in that it can setup event handlers and default options, etc for Dijit.form elements as it is inserting it into the DOM. For example, Dojo: var slider = new dijit.form.HorizontalSlider({ name: sliderContainerId+'_slider', value: sliderValue, minimum: sliderMax, maximum: sliderMin, onChange: function(value){ // some event handling logic } }, sliderContainerId); However, the jQuery UI Slider traditionally is applied to DOM elements that already exist: $( sliderContainerId ).slider({ value:100, min: 0, max: 500, step: 50, slide: function( event, ui ) { $( "#amount" ).val( "$" + ui.value ); } }); I need to be able to 'programmatically' create new Sliders (and other form elements), but I'm not sure how that could be achieved with the way jQuery is structured? Maybe I'm missing something obvious here.... MTIA

    Read the article

  • jQuery Validate - require at least one field in a group to be filled

    - by Nathan Long
    I'm using the excellent jQuery Validate Plugin to validate some forms. On one form, I need to ensure that the user fills in at least one of a group of fields. I think I've got a pretty good solution, and wanted to share it. Please suggest any improvements you can think of. Finding no built-in way to do this, I searched and found Rebecca Murphey's custom validation method, which was very helpful. I improved this in three ways: To let you pass in a selector for the group of fields To let you specify how many of that group must be filled for validation to pass To show all inputs in the group as passing validation as soon as one of them passes validation. So you can say "at least X inputs that match selector Y must be filled." The end result is a rule like this: partnumber: { require_from_group: [2,".productinfo"] } //The partnumber input will validate if //at least 2 `.productinfo` inputs are filled For best results, put this rule AFTER any formatting rules for that field (like "must contain only numbers", etc). This way, if the user gets an error from this rule and starts filling out one of the fields, they will get immediate feedback about the formatting required without having to fill another field first. Item #3 assumes that you're adding a class of .checked to your error messages upon successful validation. You can do this as follows, as demonstrated here. success: function(label) { label.html(" ").addClass("checked"); } As in the demo linked above, I use CSS to give each span.error an X image as its background, unless it has the class .checked, in which case it gets a check mark image. Here's my code so far: jQuery.validator.addMethod("require_from_group", function(value, element, options) { // From the options array, find out what selector matches // our group of inputs and how many of them should be filled. numberRequired = options[0]; selector = options[1]; var commonParent = $(element).parents('form'); var numberFilled = 0; commonParent.find(selector).each(function(){ // Look through fields matching our selector and total up // how many of them have been filled if ($(this).val()) { numberFilled++; } }); if (numberFilled >= numberRequired) { // This part is a bit of a hack - we make these // fields look like they've passed validation by // hiding their error messages, etc. Strictly speaking, // they haven't been re-validated, though, so it's possible // that we're hiding another validation problem. But there's // no way (that I know of) to trigger actual re-validation, // and in any case, any other errors will pop back up when // the user tries to submit the form. // If anyone knows a way to re-validate, please comment. // // For imputs matching our selector, remove error class // from their text. commonParent.find(selector).removeClass('error'); // Also look for inserted error messages and mark them // with class 'checked' var remainingErrors = commonParent.find(selector) .next('label.error').not('.checked'); remainingErrors.text("").addClass('checked'); // Tell the Validate plugin that this test passed return true; } // The {0} in the next line is the 0th item in the options array }, jQuery.format("Please fill out at least {0} of these fields.")); Questions? Comments?

    Read the article

  • jQuery sortable Div's

    - by kai lange
    is it possible to sort direct between two or more div's/boxe's and return the complete data (var order = ...) ? Online Demo: http://jsbin.com/alegu4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jQuery Dynamic Drag'n Drop</title> <script type="text/javascript" src="http://cdn.jquerytools.org/1.2.5/jquery.tools.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js"></script> <style> body { font-family: Arial, Helvetica, sans-serif; font-size: 16px; margin-top: 10px; } ul { margin: 0; } #s1,#s2 { float: left; width: 400px; } #s1 li,#s2 li { list-style: none; margin: 0 0 4px 0; padding: 10px; background-color:#00CCCC; border: #CCCCCC solid 1px; color:#fff; } </style> <script type="text/javascript"> $(document).ready(function(){ $(function() { $("#s1 ul,#s2 ul").sortable({ opacity: 0.6, cursor: 'move', update: function() { var order = $(this).sortable("serialize") + '&action=updateRecordsListings'; //$.post("updateDB.php", order); alert(order); } }); }); }); </script> </head> <body> <div id="box"> <div class="box" id="s1"> <ul> <li id="recordsArray_1">1. Lorem ipsum dolor sit amet, consetetur</li> <li id="recordsArray_2">2. Lorem ipsum dolor sit amet, consetetur</li> <li id="recordsArray_3">3. Lorem ipsum dolor sit amet, consetetur</li> <li id="recordsArray_4">4. Lorem ipsum dolor sit amet, consetetur</li> </ul> </div> <div class="box" id="s2"> <ul> <li id="recordsArray_5">5. Lorem ipsum dolor sit amet, consetetur</li> <li id="recordsArray_6">6. Lorem ipsum dolor sit amet, consetetur</li> <li id="recordsArray_7">7. Lorem ipsum dolor sit amet, consetetur</li> <li id="recordsArray_8">8. Lorem ipsum dolor sit amet, consetetur</li> </ul> </div> </div> </body> </html> Please note it's not the same like my other post - thanks!

    Read the article

  • jquery ui 1.7 autocomplete show dialog on select

    - by Daniel S
    Hello, I am using an autocomplete widget, and would like a dialog to show when an item is selected. The dialog does show up, but I want a field in the dialog to receive focus when it opens. Here is what I have tried so far: //HTML <form action="#"> <p><input id="busca" /></p> </form> <div id="agregar" title="Agregar Parte"> <label for="cantidad">Cantidad:</label> <input name="cantidad" id="cantidad" size="3" /> </div> //jquery $(function(){ $("#agregar").dialog({ autoOpen: false, //also tried open: function(){$("#cantidad").focus()} } ); //.bind("dialogfocus", ... ) does not work either $("#agregar").bind("focus", function(){ $("#cantidad").focus(); }); $("#busca").autocomplete({ source: "/carrito/autocomplete/", minLength: 1, select: function(e, ui) { $("#agregar").dialog("open"); } }); }); I think autoselect's default behavior is still doing something as the autoselect widget receives focus after the dialog is shown. Any help would be greatly appreciated.

    Read the article

  • jQuery datepicker validation message issue

    - by Abhishek
    Hi, I'm using the jquery datepicker plugin at http://plugins.jquery.com/project/datepick with the datepicker validation plugin. <script id="frmValidation" type="text/javascript"> $(document).ready(function(){ var validator = $("#frmTest").validate({ rules:{ fname: "required", dobPicker: "required" }, messages:{ fname: "Please enter a name", dobPicker: "Select a date" }, }); $('#dobPicker').datepick(); $.datepick.setDefaults({showOn: 'both', dateFormat: 'dd-mm-yy', yearRange:'1900:2010'}); }); </script> And the body of the document is as follows : <form id="frmTest" action="" method="post"> <div id="error-list"></div> <div class="form-row"> <span class="label"><label for="fname">Name</label></span> <input type="text" name="fname" /> </div> <div class="form-row"> <span class="label"><label for="dobPicker">DOB</label></span> <input type="text" id="dobPicker" name="dobPicker" style="margin-left: 4px;"/> </div> <div class="form-row"> <input type="submit" name="submit" value="submit"/> </div> </form> The form validates the first time but the error message for the datepicker does not disappear immediately a date is selected.. however it goes away if the date is selected the second time. Any help to make it go the first time a date is selected will be appreciated

    Read the article

  • jQuery UI Dialog adding unwanted inline styles to images

    - by oliver
    I am using JQUery UI to for the front end of a rails app I am developing. I am using jQuery dialog windows for displaying some tabbed data and inside one of these tabs I want to render some images. The rendering of the images works fine if I view the page without Javascript, however for some reason when putting it all in a dialog window all but the last image that I render gets some inline styles from somewhere! wihtout the dialog window: <img alt="Dsc_0085" class="picture" src="/system/sources/3/normal/DSC_0085.jpg?1260300748" /> <img alt="Dsc_0006" class="picture" src="/system/sources/4/normal/DSC_0006.jpg?1260301612" /> with the dialog window: <img alt="Dsc_0085" class="picture" src="/system/sources/3/normal/DSC_0085.jpg?1260300748" style="height: 0px; width: 0px; border-top-width: 1px; border-bottom-width: 1px; font-size: 22px; border-left-width: 1px; border-right-width: 1px; display: inline; "> <img alt="Dsc_0006" class="picture" src="/system/sources/4/normal/DSC_0006.jpg?1260301612" style="display: inline; "> I can't work out why putting the images into a dialog window is giving them inline styles with height and width of 0px, does anyone have any ideas?

    Read the article

  • Getting value from href using jQuery

    - by bateman_ap
    Hi, I wonder if anyone can help with a jQuery problem I am having. I am using the tooltips from the Jquery Tools library to create a popup window when mousing over an hrefed image, this I want to use to cusomise the call to change the content in the DIV. The links I am using are in the form: <a href="/venue/1313.htm" class="quickView"><img src="/images/site/quickView83.png" alt="Quick View" width="83" height="20" /></a> The code I am using to trigger the tip is: $(".quickView").live('mouseover', function() { if (!$(this).data('init')) { $(this).data('init', true); ajax_quickView(); $(this).tooltip ({ /* tooltip configuration goes here */ tip: "#quickViewWindow", position: "right", offset: [0, -300], effect: 'slide' }); $(this).trigger('mouseover'); } }); I have tried the following function to grab the ID (in the example above, 1313) from the link: function ajax_quickView(){ var pageNum = $("a.quickView").attr("href").match(/venue/([0-9]+)/).htm[1]; $("#quickViewWindow").load("/quick-view/", function(){}) } However I think this is where it falls down, I think my regex is prob to blame... Once I get the var pageNum I presume I can just pass it into the .load as: $("#quickViewWindow").load("/quick-view/", {id : pageNum }, function(){}) Many thanks

    Read the article

  • How to use JQUERY to filter table rows dynamically using multiple form inputs

    - by tresstylez
    I'm displaying a table with multiple rows and columns. I'm using a JQUERY plugin called uiTableFilter which uses a text field input and filters (shows/hides) the table rows based on the input you provide. All you do is specify a column you want to filter on, and it will display only rows that have the text field input in that column. Simple and works fine. I want to add a SECOND text input field that will help me narrow the results down even further. So, for instance if I had a PETS table and one column was petType and one was petColor -- I could type in CAT into the first text field, to show ALL cats, and then in the 2nd text field, I could type black, and the resulting table would display only rows where BLACK CATS were found. Basically, a subset. Here is the JQUERY I'm using: $("#typeFilter").live('keyup', function() { if ($(this).val().length > 2 || $(this).val().length == 0) { var newTable = $('#pets'); $.uiTableFilter( theTable, this.value, "petType" ); } }) // end typefilter $("#colorFilter").live('keyup', function() { if ($(this).val().length > 2 || $(this).val().length == 0) { var newTable = $('#pets'); $.uiTableFilter( newTable, this.value, "petColor" ); } }) // end colorfilter Problem is, I can use one filter, and it will display the correct subset of table rows, but when I provide input for the other filter, it doesn't seem to recognize the visible table rows that are remaining from the previous column, but instead it appears that it does an entirely new filtering of the original table. If 10 rows are returned after applying one filter, the 2nd filter should only apply to THOSE 10 rows. I've tried LIVE and BIND, but not working. Can anyone shed some light on where I'm going wrong? Thanks!

    Read the article

  • How to submit the form using JQuery UI?

    - by Vafello
    I have a form in html with a default submit button. After the form is submitted, a php file is run (with action = homelocation). I decided to use JQuery UI dialog to display the form. I have 2 default buttons there - one to save and one to close the dialog. Can anyone tell me how to assign the form submit button action to the JQuery dialog button(i.e. replace the submit button from the form with the one in the dialog)? Here's my code: <div id="userdialog" title="Add"> <form id="add" action="engine.php" method="POST"> <input type="hidden" name="action" value="homelocation" id="action"> <button type="submit">Save this location</button> </form></div> Dialog: $('#userdialog').dialog({ width: 260, position: [250,100], buttons: { "Save": function() { HERE GOES THE REQUIRED FUNCTION $(this).dialog('close'); }, "Don't Save": function() { $(this).dialog("close"); } } });

    Read the article

  • Inserting an element within jQuery Validation plugin's error template

    - by simshaun
    I'm utilizing the jQuery Validation plugin for my form. It lets you change the errorElement and wrap the errorElement using with the wrapper option. But, I want to insert an element within errorElement like this: <label class="error"><em></em>Error message goes here</label> Is there an easy way to accomplish inserting the em tag? I've tried prepending the em tag using the errorPlacement option (see below), but it seems the plugin is replacing the contents of errorElement afterwards. $.validator.setDefaults({ errorPlacement: function(error, element) { error.prepend('<em/>'); error.insertBefore(element); } }); I've also tried prepending the em tag using the showErrors option (see below). Again, it seems the plugin is replacing the contents of errorElement afterwards. $.validator.setDefaults({ showErrors: function(errorMap, errorList) { for (var i = 0; i < errorList.length; i++) { var error = errorList[i], $label = this.errorsFor(error.element), $element = $(error.element); if ($label.length && $label.find('em').length == 0) { $label.prepend('<em/>'); } } this.defaultShowErrors(); } }); I've also tried modifying the plugin so that when the error element is generated, the <em> tag is prepended. That works until I focus on a form element that has an error, after which the em tag is removed. (It's doing this because jQuery validation is constantly updating the contents of the error element as I focus and/or type in the field, therefore erasing my em tag added at error-element creation.)

    Read the article

  • Best method to select an object from another unknown jQuery object

    - by Yosi
    Lets say I have a jQuery object/collection stored in a variable named obj, which should contain a DOM element with an id named target. I don't know in advance if target will be a child in obj, i.e.: obj = $('<div id="parent"><div id="target"></div></div>'); or if obj equals target, i.e.: obj = $('<div id="target"></div>'); or if target is a top-level element inside obj, i.e.: obj = $('<div id="target"/><span id="other"/>'); I need a way to select target from obj, but I don't know in advance when to use .find and when to use .filter. What would be the fastest and/or most concise method of extracting target from obj? What I've come up with is: var $target = obj.find("#target").add(obj.filter("#target")); UPDATE I'm adding solutions to a JSPERF test page to see which one is the best. Currently my solution is still the fastest. Here is the link, please run the tests so that we'll have more data: http://jsperf.com/jquery-selecting-objects

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >