[jQuery] Re: jQuery 1.2.6 clone problem with internet explorer.
Sorry, I just noticed you are using 1.2.6. Ignore my reply. On Jan 14, 11:26 am, Jules wrote: > This clone() works for me in ie 6.0 :). May be C.fx.step is an > element in your page and IE 6 can't find it for some reason? > > > </ > script> > > <script type="text/javascript"> > $(document).ready(function() { > $("#btnCloneIt").click(function() { > $("#container").append($("#toBeCloned").clone()); > }); > }); > > > > > > > I am a clone > > name="btnCloneIt" /> > > > On Jan 14, 4:51 am, "m.ugues" wrote: > > > Hallo all. > > When i call the clone() function in Internet Explorer jQuery > > meltdowns :( > > > The error reported in ie6 is: > > C.fx.step is null or not an object. > > > Any idea how to fix the problem? > > > Kind regards > > > Massimo
[jQuery] Re: jQuery 1.2.6 clone problem with internet explorer.
This clone() works for me in ie 6.0 :). May be C.fx.step is an element in your page and IE 6 can't find it for some reason? $(document).ready(function() { $("#btnCloneIt").click(function() { $("#container").append($("#toBeCloned").clone()); }); }); I am a clone On Jan 14, 4:51 am, "m.ugues" wrote: > Hallo all. > When i call the clone() function in Internet Explorer jQuery > meltdowns :( > > The error reported in ie6 is: > C.fx.step is null or not an object. > > Any idea how to fix the problem? > > Kind regards > > Massimo
[jQuery] Re: Filter xml data before display
Use .ajax to get filtered the data on the server, instead of retrieving all xml data and filtering the data on the client. On Jan 12, 9:06 am, stevo wrote: > Hi all, > > I have an xml file that is dynamically generated at periodic intervals > onto disk. the information contained in this file is displayed in a > vertical scroller and this works fine. > > I however need to filter the data based on the logged-in users > preferences. These preferences are stored in a database and retrieved > after the user logs in. > > Only data in the xml file that match the user's preferences must be > displayed. > > Thanks in advance.
[jQuery] Re: Need help with a required field from radio selection
$("form").validate( { rules: { legal_status_comment: { required: function(element) { return $ ("[name=legal_status]:checked").attr("id") == "other_radio"; } } } }); On Jan 12, 3:43 am, jeffself wrote: > I've got a form with a radio group called 'legal_status'. There are > five radio buttons. The last one has an id='other_radio'. If this > button is selected, I have a textarea field that gets displayed. The > field has an id='legal_status_comment'. This textarea field is wrapped > by a div with an id='other_text_area' that is hidden until the > other_radio button is selected. > > How do I write the rule to make the 'legal_status_comment' field to be > required if the 'other_radio' button has been selected? > > Thanks!
[jQuery] Re: Go through XML nodes only 1 level deep
As suggested by Steven, set the ContentType to "text/xml". I don't know how to do it in php, but here is the snipped from data source in c# . StringBuilder sb = new StringBuilder(); sb.Append(""); sb.Append(""); sb.Append("74.125.45.100"); sb.Append("OK"); sb.Append("US"); sb.Append("United States"); sb.Append("06"); sb.Append("California"); sb.Append("Mountain View"); sb.Append("94043"); sb.Append("37.4192"); sb.Append("-122.057"); sb.Append("-8"); sb.Append("-8"); sb.Append("-7"); sb.Append(""); Response.Clear(); Response.ContentType = "text/xml"; Response.Write(sb.ToString()); Response.End(); On Jan 8, 2:42 am, Frank Peterson wrote: > That works in IE8, but in FF 3.5.3 I get undefined in the alertbox. > I've disabled adblock and flashblock, so its not those interfering. I > dont get anything in the error console either. > > The code I had posted earlier doesn't work in FF 3.53 either. I'm > accessing it by running it on my desktop with this as the URL > file:///c:/xampplite/htdocs/DEVELOPMENT/geolocate.htm > but even when I access it via a decent URL I still get undefined in > FFhttp://localhost/DEVELOPMENT/geolocate.htm > > On Jan 6, 10:13 pm, Jules wrote: > > > Ahah, too much stale eggnog. > > > var option = { > > error: function(request, status, error) { > > alert(error); > > }, > > success: function(data, status) { > > > var xml = $(data); > > alert(xml.find('City').text()); > > }, > > dataType: "xml", > > type: "GET", > > url: "your url here" > > }; > > > $.ajax(option); > > > This code works for me. > > > On Jan 7, 2:50 pm, Steven Yang wrote: > > > > just making sure > > > > you are not able to parse the xml at all right? > > > i believe for IE you have to make sure you server returns the correct > > > content type like text/xml to client inorder for you to parse > > > > hope this help > > > > On Thu, Jan 7, 2010 at 9:30 AM, Jules wrote: > > > > For some reason, it works on firefox (3.5.6) and doesn't work in ie > > > > 6.0 and 8.0 > > > > > On Jan 7, 6:39 am, Frank Peterson wrote: > > > > > I'm grabbing an XML file with jQuery like this: > > > > > > $(document).ready(function(){ > > > > > $.ajax({ > > > > > type: "GET", > > > > > url: "http://ipinfodb.com/ip_query.php?ip=74.125.45.100";, > > > > > dataType: "xml", > > > > > success: function(xml) { > > > > > //$(xml).find().each(function(){ > > > > > var city = $(xml).find("City").text(); > > > > > /* > > > > > $('').html > > > > > (''+title+'').appendTo('#page-wrap'); > > > > > $(this).find('desc').each(function(){ > > > > > var brief = $(this).find('brief').text(); > > > > > var long = $(this).find('long').text(); > > > > > $(' > > > > class="brief">').html(brief).appendTo > > > > > ('#link_'+id); > > > > > $('').html(long).appendTo > > > > > ('#link_'+id); > > > > > }); > > > > > */ > > > > > alert(city) > > > > > //}); > > > > > } > > > > > }); > > > > > > }); > > > > > > The XML file looks like this > > > > > > > > > > > > > > > 74.125.45.100 > > > > > OK > > > > > US > > > > > United States > > > > > 06 > > > > > California > > > > > Mountain View > > > > > 94043 > > > > > 37.4192 > > > > > -122.057 > > > > > -8 > > > > > -8 > > > > > -7 > > > > > > > > > > > But I can't get it to pull the data out.
[jQuery] Re: Go through XML nodes only 1 level deep
Ahah, too much stale eggnog. var option = { error: function(request, status, error) { alert(error); }, success: function(data, status) { var xml = $(data); alert(xml.find('City').text()); }, dataType: "xml", type: "GET", url: "your url here" }; $.ajax(option); This code works for me. On Jan 7, 2:50 pm, Steven Yang wrote: > just making sure > > you are not able to parse the xml at all right? > i believe for IE you have to make sure you server returns the correct > content type like text/xml to client inorder for you to parse > > hope this help > > On Thu, Jan 7, 2010 at 9:30 AM, Jules wrote: > > For some reason, it works on firefox (3.5.6) and doesn't work in ie > > 6.0 and 8.0 > > > On Jan 7, 6:39 am, Frank Peterson wrote: > > > I'm grabbing an XML file with jQuery like this: > > > > $(document).ready(function(){ > > > $.ajax({ > > > type: "GET", > > > url: "http://ipinfodb.com/ip_query.php?ip=74.125.45.100";, > > > dataType: "xml", > > > success: function(xml) { > > > //$(xml).find().each(function(){ > > > var city = $(xml).find("City").text(); > > > /* > > > $('').html > > > (''+title+'').appendTo('#page-wrap'); > > > $(this).find('desc').each(function(){ > > > var brief = $(this).find('brief').text(); > > > var long = $(this).find('long').text(); > > > $('').html(brief).appendTo > > > ('#link_'+id); > > > $('').html(long).appendTo > > > ('#link_'+id); > > > }); > > > */ > > > alert(city) > > > //}); > > > } > > > }); > > > > }); > > > > The XML file looks like this > > > > > > > > > 74.125.45.100 > > > OK > > > US > > > United States > > > 06 > > > California > > > Mountain View > > > 94043 > > > 37.4192 > > > -122.057 > > > -8 > > > -8 > > > -7 > > > > > > > But I can't get it to pull the data out.
[jQuery] Re: Go through XML nodes only 1 level deep
For some reason, it works on firefox (3.5.6) and doesn't work in ie 6.0 and 8.0 On Jan 7, 6:39 am, Frank Peterson wrote: > I'm grabbing an XML file with jQuery like this: > > $(document).ready(function(){ > $.ajax({ > type: "GET", > url: "http://ipinfodb.com/ip_query.php?ip=74.125.45.100";, > dataType: "xml", > success: function(xml) { > //$(xml).find().each(function(){ > var city = $(xml).find("City").text(); > /* > $('').html > (''+title+'').appendTo('#page-wrap'); > $(this).find('desc').each(function(){ > var brief = $(this).find('brief').text(); > var long = $(this).find('long').text(); > $('').html(brief).appendTo > ('#link_'+id); > $('').html(long).appendTo > ('#link_'+id); > }); > */ > alert(city) > //}); > } > }); > > }); > > The XML file looks like this > > > 74.125.45.100 > OK > US > United States > 06 > California > Mountain View > 94043 > 37.4192 > -122.057 > -8 > -8 > -7 > > > But I can't get it to pull the data out.
[jQuery] Re: remote validation on empty field
Sorry forgot the code: $("#field").rules("add", { remote: { url:"test.asp", type: "post", data: {fieldvalue: function(){ if ($("#field").val() == "") return "empty"; else return $("#field").val(); } } } }); On Dec 7, 9:15 am, Jules wrote: > May be a dumb suggestion, but can't you set the value as "empty" when > there is no value? > > On Dec 6, 7:53 pm, david wrote: > > > Hi all, > > > I want to make a remote validation on an empty field. Sometimes the > > field may be empty and sometimes not. This depends on the selection of > > other elements. I send them with the data hash of the remote method. > > The response should be written next to the empty field. > > As i understand, by default an empty field is not validated(this is a > > feature), but how may i force the plugin to make it ? > > > Thanks, > > David
[jQuery] Re: remote validation on empty field
May be a dumb suggestion, but can't you set the value as "empty" when there is no value? On Dec 6, 7:53 pm, david wrote: > Hi all, > > I want to make a remote validation on an empty field. Sometimes the > field may be empty and sometimes not. This depends on the selection of > other elements. I send them with the data hash of the remote method. > The response should be written next to the empty field. > As i understand, by default an empty field is not validated(this is a > feature), but how may i force the plugin to make it ? > > Thanks, > David
[jQuery] Re: Attribute filters doesn't work with similar values
Put a space after me or alternatively, use a delimiter if it is possible. -- HTML < a href="site" rel="me " >me< /a > < a href="site" rel="met" >met< /a > -- Code xfn_me = $("a[rel*='me ']").length; or xfn_me = $("a[rel*='me.']").length; On Nov 17, 6:57 am, UVL wrote: > I'm trying to filter the XFN relationships meta data. If you don't > know, it works like this: > > < a href="site" rel="friend colleague" >Name< /a > > > in REL you can have various values, like "friend", "collegue" but even > "me" and "met" > > because you can have multiple values, I did this: > > xfn_me = $("a[rel*=me]").length; > > but this doesn't work, because both "me" and "met" are matched! > > Is there a way to filter the values exactly, even when there are > multiple values?
[jQuery] Re: Validation plugin rules() ???
http://docs.jquery.com/Plugins/Validation/Methods Also, I found it was worth while to look into jquery.validation.js code. On Nov 17, 8:55 am, "Atkinson, Sarah" wrote: > Is there a list somewhere of what the options are for the rules (required, > email) > I can't seem to find more info on this in the jquery site.
[jQuery] Re: Newbie validator question/problem
Can't you use remote validation? This code should work. $("#password").rules("add", { messages: { remote: "Invalid password." }, required: true, remote: { url: ".../UVServer/login.php", type: "get", data: { email: function() { return $("#email").val(); }, password: function() { return hex_md5($('#password').val()); } } } }); On Nov 15, 1:45 pm, sprach wrote: > I am new to javascript, jquery and validator, but really see the > potential and am trying to use in a new application. I am having a > little trouble wrapping my head around the layers of callbacks. > > I have a simple login form that I want to validate, but want to send > an md5 encrypted password to the server. All of my validation works > until I try and submit the form. Here is the code snippet of the > validator submit handler: > > > submitHandler: function(form) { > > var pwd = $('#password').val(); // md5 encode > the password > md5pwd = hex_md5(pwd); > //$('#password').val(pwd); > > $.get('../UVServer/login.php','email='+$ > ('#email').val()+ '&password='+ md5pwd, > function(resp) { > if (resp == 'false') > { > // password didn't match > validator.showErrors({"password": > "Incorrect Password or Email Address!"}); > > return false; > } > form.submit(); // Password matched, submit > the form > > }) > > }, > ... > > The problem that I run into is that I cannot call form.submit() in the > anonymous call back that I use for the jquery $.get call. In the code > above, firebug claims that form.submit() is not a function. > > I have tried many work arounds but nothing seems to work. I don't > want to use the "remote" rule, because I don't want to pass the > unencrypted password to the server. > > Help greatly appreciated.
[jQuery] Re: Count items inside/outside of visible area
This code should works as it retrieves the parent height during run- time $(document).ready(function() { var cnt1 = $("#test_list").parent().css("height"); var cnt2 = $("#test_list").children(":first").css ("height"); var re = /px/g; alert(parseFloat(cnt1.replace(re, "")) / parseFloat (cnt2.replace(re, ""))); //five $("#test_list").parent().css("height", "120px"); cnt1 = $("#test_list").parent().css("height"); alert(parseFloat(cnt1.replace(re, "")) / parseFloat (cnt2.replace(re, ""))); // six }); On Nov 15, 1:35 am, gravyfries wrote: > Any idea how to make this work? In the following example I need to > know how many items fall inside/outside of the visible area. This > can't be based on the height of the parent div because that will be > variable eventually: > > > > > > > $(document).ready(function(){ > var cnt = $('#test_list li:visible').size(); > alert(cnt); > }); > > > ul, li {padding: 0; margin: 0;} > li {height: 20px;} > > > > > > > Test > Test > Test > Test > Test > Test > Test > Test > Test > Test > Test > Test > > > > >
[jQuery] Re: (validate plugin) dependency callback not being triggered
Hi, Validation only triggered if you call submit the page or call the $ ("form").valid() function. I didn't see any submit() or $ ("form").valid() call in your page. Try adding this to your page js script inside ready() $("#validateMe").click(function(){ if($("form").valid()) alert("All data are valid"); else alert("Invalid data"); }); html Hope this help. BTW: you misspelled territory in ACT :) On Nov 6, 12:06 pm, Brad Hile wrote: > Bump > > > Hi > > I've tried every way I can think of to use dependency to enable > > additional elements to be required and have had no luck at all. I > > simply want to enable "required" on a number of fields when a specific > > radio button is selected and for it to be disabled when its not. > > (These fields are hidden when the radio button is deselected) > > I've tested the response from the functions and it appears correct but > > after hours of staring at this I just can't figure it out. > > Help.. please? > > > original code is onhttp://promotionalpenshop.com.au/testorder.php?p=4 > > though I may have changed it by the time you look at this. > > > So basically I've tried an inline function something like: > > > organisation:{required: function(element) { > > return $(".payment_type:checked").val() == 'invoice'); > > } > > } > > - - - - - - - - - - - - - - > > Setting a var to true/false when the radio button is clicked and > > testing that: > > > var invoice; > > > $(".payment_type").change(function () { > > if($(this).val() != 'paypal'){ > > $("#paybyinvoicefields").slideDown('slow'); > > invoice = true; > > } else { > > $("#paybyinvoicefields").slideUp('slow'); > > invoice = false; > > } > > > organisation:{required: invoice} > > - - - - - - - - - - - - - - > > Using an enternal function > > > organisation:{required: invoiceme() } > > > function invoiceme() { > > return ($(".payment_type:checked").val() == 'invoice')? > > true : false; > > }
[jQuery] Re: Submitting after Validation
Hi Stephen, Try using input type="button" instead of "submit" as per my example below. Excuse the aspx :). register.aspx code. string usrName = Request["userName"]; Response.Clear(); Response.Write("Hello " + usrName); Response.End(); -- client side code and html $(document).ready(function() { $("form").validate(); $("#userName").rules("add", { required: true, messages: { required: "User Name is required." } }); $("#submitForm").click(function() { if ($("form").valid()) { $.post("register.aspx", $("form").serialize(), function (data, status) { $("#message").text(data) }, "text") } }); }); User Name: --- end of client side code and html On Nov 5, 7:41 am, StephenJacob wrote: > Just to clarify, the $.post function works perfectly and returns my > json results. Due to the limitations of the validation system i was > using (no remote options) i had to begin using the standard > jquery .validate library. > > Please help me understand how to implement the .Validate w/ my HTML > form. > > As you can see the $.post option has the process.php written in the > Jquery and leaves the HTML form action blank. With the > Jquery .Validate, I need to define the process.php as the Action > correct? If so, why does the form continue to submit normally? > > Thanks for all the help everyone! I think with a bit more guidance > i'll have a really strong understanding of the validation system. > > On Nov 4, 3:33 pm, StephenJacob wrote: > > > @Leonard, unfortunately it's not due to the function argument. > > > @Dylan, I've looked at this tutorial a few times. It's not using the > > official Jquery Validate system and hasn't been able to help me fill > > in any gaps in my learning curve... It seems that every tutorial has > > their own convoluted system to doing validation.. And the ones that do > > use the standard validation system none of them thoroughly explain the > > form submission part. > > > This is my current working Validation code + Submit function that does > > not work properly. It post the page normally, like any HTML form > > would. > > > $(document).ready(function(){ > > > $("#contactForm").validate({ > > > rules: { > > fullname: { > > required: true, > > minlength: 2 > > }, > > email: { > > required: true, > > email: true > > }, > > company: { > > required: true, > > minlength: 2 > > }, > > phone: { > > required: true, > > minlength: 2 > > }, > > > }, > > messages: { > > fullname: 'Please enter your > > full name. > span>', > > email: 'Please enter a valid > > email address > b>.', > > company: 'Please enter your > > company. > span>', > > phone: 'Please enter your > > phone number. > span>' > > }, > > submitHandler: function() { > > form.submit(); > > } > > }); > > > }); > > > // HTML FORM > > > > > //Stuff goes here > > > > > // WORKING VALIDATION USING LIMITED VALIDATION SYSTEM > > > $(document).ready(function(){ > > > $("#signupForm #submit").click(function(){ > > > $(".error").hide(); > > var hasError = false; > > var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; > > > var regarding_Val = $("#regarding").val(); > > var message_Val = $("#message").val(); > > var subcontact = $("#subcontact").val(); > > > var fullname_Val = $("#fullname").val(); > > if(fullname_Val == '') { > > $("#fullname").after('Please > > enter your full > > name.'); > > hasError = true; > > } > > > var company_Val = $("#company").val(); > > if(company_Val == '') { > > $("#company").after('Please > > enter your > > company.'); > > hasError = true; > > } > > > var phone_Val = $("#phone").val(); > > if(phone_Val == '') { > > $("#phone").after('Please enter > > a phone > > number.'); > > hasError = true; > > } > > > var email_Val =
[jQuery] Re: Simple problem
Modify this line of code var panelID = "panel_" + $("input").val(); to var panelID = "panel_" + $(this).val(); On Oct 30, 9:56 am, AlChuck wrote: > Hello, I'm new to using jQuery. I was motivated by wanting to put some > panels on an ASP.NET website which would display additional info if a > link or button was clicked. I found a simple tutorial and mimicked > that and it works fine, but uses the specific ID of the hyperlink to > trigger the action. My page needs a list of items, and if you click on > one, extra information appears right below the item. So what I want to > do is capture clicks on any link, read the ID, and then use the ID to > identify the ID of the related asp:Panel element. > > Here's the starting point: > > > $(function() { > $("#myButtonID").click(function(evt) { > evt.preventDefault(); > $('#myPanelID').toggle('fast'); > }); > }); > > > If you click on the button rendered thusly: > > > > The panel with id="myPanelID" is toggled (the CSS defines it so that > display is set to "none" by default. > > But I want a list of these panels and buttons on my page, so I want > the code to be able to do this for any of the buttons I click. > > It also works if instead of the button with the specific ID > "myButtonID" I change > > $("#myButtonID").click(function(evt) > > to > > $("input").click(function(evt) > > My impression is that this will cause the code to trigger if any input > element on the page is clicked, which is the first step to what I want > to do. My notion is that I can then get the value of the clicked > button and use that value to identify which panel to animate. > > One of the FAQs on the jQuery site says I can get the value of the > button thusly: > > var mybuttonval = $("input").val(); > > Then I could use a simple naming convention and use that value to > identify the Panel I want to animate. For example, if my button had > the value "ACME_widget-mach1" I could set the Panel I want to show > text in to "panel_ACME_Widget-mach1" > > So I rewrote my code as follows: > > > > $(function() { > $("input").click(function(evt) { > var panelID = "panel_" + $("input").val(); > evt.preventDefault(); > $(panelID).toggle('fast'); > }); > }); > > > It appeared to work just like I hoped... until I put in a second > button/panel pair, with button ID= ACME_widget-mach2 and panel ID= > panel_ACME_widget-mach1. What happens is, regardless of which button I > click, only the first panel, the one with ID=panel_ACME_widget-mach1 > is toggled. > > It's as if when any button is clicked, the value I am getting is the > value of the first button in the collection. I put in an alert box > right after declaring the variable to test this: > > alert(panelID); > > and sure enough, the value that displays is the value assigned to the > first of these buttons on the page. > > So what am I doing wrong here? How can I get the value of the button > that is actually clicked? > > Thanks! > > Alan
[jQuery] Re: (validate) validator is undefined error
Sorry, didn't read the question thoroughly, whyvisitother: { required: function(element) { var result = false; var chk = $("[name=whyvisit]"); $("[name=whyvisit]:checked").each(function () { if (chk.index($(this)) == 4) result = true; }); return result; } } On Oct 30, 12:14 am, Collectonian wrote: > Thanks, but that only seems to work if they only pick other. Since > they can pick multiple checkboxes from that set, I need to see if they > picked it among possibly multiple others. > > On Oct 28, 5:50 pm, Jules wrote: > > > Use this rule. > > whyvisitother: { > > required: function(element) { > > return $("[name=whyvisit]").index($ > > ("[name=whyvisit]:checked")) == 4; > > }
[jQuery] Re: (validate) validator is undefined error
Use this rule. whyvisitother: { required: function(element) { return $("[name=whyvisit]").index($ ("[name=whyvisit]:checked")) == 4; } On Oct 29, 7:34 am, Collectonian wrote: > With the suggestion earlier, everything is working great, yay! All of > my validation rules are also working, as well, except I can't figure > out how to write the rule for my multi-option check box that has an > "Other" option so that if other is among those checked, it will > require the other input box be filled in. I have two similar ones like > that, but since they are radio buttons, I was able to just use rules > based on the demos. The rules I have and the relevant bit of the HTML > form below for easier reading. Basically, if one of the options > selected in the whyvisit set of checkboxes is the other option, the > whyvisitother input field needs to be required. > > ~~ SNIPPET ~~ > rules: { > recommend: "required", > howlearnedother: { > required: function(element) { > return $('#howlearned input[name=howlearned]:checked').val() > == 0; > } > }, > describeyouother: { > required: function(element) { > return $('#describeyou > input[name=describeyou]:checked').val() == 0; > } > } > > }, > > ~~HTML ~~ > Why did you visit the SRAC web site? > > value="1" /> Aquaculture producer looking for information name="whyvisit" type="checkbox" class="checksandradios" value="2" /> > Educator looking for information for my classroom > > > Middle School > High School > 2-Year College > 4-Year College > > > value="3" /> Student > > > Middle School > High School > 2-Year College > 4-Year College > > > value="4" /> Individual interested in learning more about > aquaculture > value="0" /> Other type="text" value="" size="30" maxlength="30" /> >
[jQuery] Re: (validate) validator is undefined error
Change var validator = $("#surveyForm").validate({ to var validator = $("form").validate({ or to Good luck. On Oct 28, 7:54 am, Collectonian wrote: > I'm trying to implement Validate on a survey form that has just a few > basic requirements. I'm running jQuery 1.3.2 and Validate 1.5.5. > Whenever I try to run the code, however, I get an error that > "validator is undefined". I tried Googling and found only a few hits, > most saying the HTML was invalid. Checked that, corrected a few minor > errors, but still getting the error. In addition to the code below, I > tried just the basic $("#surveyForm").validate() but it still gives > the same error. This is on a development application, so it isn't > available online yet. > > Summer > > SNIPPET FROM JS FILE > var validator = $("#surveyForm").validate({ > rules: { > recommend: "required", > howlearnedother: { > required: function(element) { > return $('#howlearned > input[name=howlearned]:checked').val() == 0; > } > }, > describeyouother: { > required: function(element) { > return $('#describeyouother input > [name=describeyouother]:checked').val() == 0; > } > } > }, > messages: { > recommend: "Please indicate if you would recommend the SRAC > site to > others", > howlearnedother: "Please indicate how you learned about SRAC's > publications.", > describeyouother: "Please indicate your industry." > } > > }); > > ~~~SNIPPET OF HTML FORM > > > > Please complete this survey to help > us improve our > offerings: > What is the likelihood > that you would > recommend the SRAC web site or its publications to your family and > friends? Choose one number below with 1 = not likely and 10 = highly > likely. > > > type="radio" value="1" /> 1 > type="radio" value="2" /> 2 > type="radio" value="3" /> 3 > type="radio" value="4" /> 4 > type="radio" value="5" /> 5 > type="radio" value="6" /> 6 > type="radio" value="7" /> 7 > type="radio" value="8" /> 8 > type="radio" value="9" /> 9 > type="radio" value="10" /> 10 > > > How did you learn > about SRAC publications? > > > > type="radio" class="checksandradios" > value="1" /> Linked from another web site > > type="radio" class="checksandradios" > value="2" /> Search engine > > type="radio" class="checksandradios" > value="3" /> Professional (e.g. Fisheries/aquaculture biologists) > > > type="radio" class="checksandradios" > value="4" /> Extension program > > type="radio" class="checksandradios" > value="5" /> Friend > > type="radio" class="checksandradios" > value="6" /> Magazine > > type="radio" class="checksandradios" > value="7" /> Book > > type="radio" class="checksandradios" > value="0" /> Other value="" type="text" size="30" maxlength="30" /> > > > > Why did you visit the > SRAC web site? > > > type="checkbox" class="checksandradios" > value="1" /> Aquaculture producer looking for information > > type="checkbox" class="checksandradios" > value="2" /> Educator looking for information for my classroom > > id="whyvisiteducator"> > > name="whyvisiteducator"> > > > Middle School > > >
[jQuery] Re: Prevent key to change values
Put the calculation logic in blur event? $("input[type='text']:order").blur(function(){ $('#total_buyed').val( v * 2.75 ); }) On Oct 26, 4:18 am, ReynierPM wrote: > Hi every: > I have this function: > > $("input[type='text']:order").keyup(function() { > var v = $(this).val().replace(/\D/g,''); // removes non numbers > $('#total_buyed').val( v * 2.75 ); > > }); > > The function is working correctly but when I press any key the same > operation is calculated. How to avoid this? See online > athttp://jose-couto.com/pintpal4/order_pintpal2.html > Cheers and thanks in advance > -- > ReynierPM
[jQuery] Re: How to know which button is clicked
Use a variable? var buttonClicked = ''; $("#delete").click(function(){ buttonClicked ='delete'; . }) $("#view").click(function(){ buttonClicked ='view'; . }) submitHandler: function(form) { if(buttonClicked == 'delete') {//do delete} else if (buttonClicked == 'view') {//do view} } } On Oct 24, 6:20 am, mathie wrote: > Hello, > > I have a form with two buttons: "Delete" and "View". A checkbox is > required for all actions. Validation happens when a button is clicked. > If it's "View", it is just a normal operation. However, if it's > "Delete", if the form is valid, it then needs to show a confirmation > before form submission via custom handler (submitHandler). > > submitHandler: function(form) { if (confirmDelete()) { form.submit > (); } } > > Problem: How do I know if the button is Edit or Delete inside > submitHandler? The function above open the dialog even for "View" > button. > > Thanks for any suggestion.
[jQuery] Re: show/hide problem
If a.more is a child of the div, use this code. $(document).ready(function() { $("div.featured-cell-padding").mouseenter(function(){ $(this).find("a.more").show(); }); $("div.featured-cell-padding").mouseleave(function(){ $(this).find("a.more").hide(); }); }); On Oct 25, 1:13 am, Daniel Donaldson wrote: > I am trying to have a image (link button) appear within a div on > mousenter for the div, and disappear on mouseleave. > I have this working in the following code as expected, but I only want > it to apply to the specific div that is being entered/left. > The way I have it right now it applies to the class, so every div with > the class will trigger the function, which is not the desired effect : > ( > > What I would like to have it do is have the image show/hide only > within the specific div that is being entered/left. > Due to the nature of the project, I cannot simply apply id's to the > divs as a solution. > > The code follows, I apologize that I cannot provide a live link, it > isn't online yet, but I have pasted the code below: > > // > $('a.more').hide(); > > // > $('div.featured-cell-padding').mouseenter(function() { > $('a.more').show(); > return false; > }); > > // > $('div.featured-cell-padding').mouseleave(function() { > $('a.more').hide(); > return false; > }); > > }); > > thanks for any help/insight/words of wisdom :)
[jQuery] Re: Is it possible to clone all attributes on an element and copy to a DIFFERENT type of element?
Try this. $(document).ready(function() { $("#convert").click(function() { re = /TEXTAREA/g; $("#newContainer").append($("").append($ ("#test")) .html() .replace(re, "DIV")); }); }); -- HTML Old Container This is text area New Container On Sep 24, 7:51 am, mawcreative wrote: > OBJECTIVE: Copy all the attributes of a TEXTAREA element then apply > them to a new element (ie. a DIV) and finally delete the original > TEXTAREA element. > > POSSIBILE SOLUTIONS: > > 1) I could write a function that cycles through all possible attribute > names (ie. class, style, title, name, id, etc.) and if they exist copy > their values to the DIV element (but this seems intensive -- is there > a shortcut?) > > 2) I looked at trying to set the .nodeName property but it only has a > getter method, not a setter method (it's read-only) > > Any ideas? > > Thanks in advance...
[jQuery] Re: triggering handlers for native events
You are right, when click() event is triggered, the check box/radio button value is the original value. Use change(fn) to detect the after click() value. On Sep 11, 10:40 am, Mike McNally wrote: > Am I the only person who finds wildly wrong the jQuery behavior of > handler invocation for native events on state-changing elements like > check boxes and radio boxes? Specifically, when the user clicks a > check box or a radio box, the state of the element is changed and then > the handler is invoked. However, when I call "click()" on the > elements, the handler is invoked *before* the element value is > updated. That makes it pointlessly difficult to write handler routines > that need to look at the value to know what to do. > > Am I just doing something wrong? This is something I've been dealing > with for years now and it's always driven me nuts. > > -- > Turtle, turtle, on the ground, > Pink and shiny, turn around.
[jQuery] Re: key - value
You can use array. var arr = new Array(); arr['Some Text 1'] = 41; arr['Some Text 2'] = 42; arr['Some Text 3'] = 43; arr['Some Text 4'] = 44; arr['Some Text 5'] = 45; alert(arr['Some Text 4']) On Sep 10, 12:43 am, TiGeRWooD wrote: > Hi, > > Is there a way to use > > $key => $value > 45 => 'some text' > > And search in $value (some text) but when I select 'some text', it's > the $key (45) as input value instead 'some text' ? > > Thanks in advance. > > ps : sorry for my poor english.
[jQuery] Re: How can I get current Index?
This works, but there could be a more elegant way to do it. $(document).ready(function() { var cnt; $("tr").each(function() { cnt = 0; $(this).find("td").each(function() { $(this).find("a").each(function() { alert(cnt) }); cnt++; }); }); }); On Sep 6, 12:28 pm, din wrote: > > 1 > JM-53 > -- > -- > -- > ROHs > > 2 > JM-54 > ROHs > -- > -- > ROHs > > I want the value of "href" in first tag A is equal to "JM-53_5.htm". > And the the value of "href" in 2nd tag A is equal to "JM-54_2.htm". > The value of "href" in 3rd tag A is equal to "JM-54_5.htm". > HOW can I get the current Index of the tag A,and HOW TO get the value > of the current 2nd tag TD. > > MANY MANY THANKS
[jQuery] Re: Select Span with Span Parent
Is this what you are after? $("span span") On Sep 1, 12:14 pm, a1anm wrote: > Hi, > > How would I select all spans which have a span as a parent? > > Thanks!
[jQuery] Re: Append data using Slide In animation
try this $(data).appendTo("#chat_box").show(); On Aug 31, 3:14 am, Namir wrote: > Well I want to append some data to a div called chat_box but I want it > to slide in from the bottom as it appears, the code Im currently using > to attempt to reach this is > success: function(data){ > $('#chat_box').append(data.show("slide", {direction: "down"}, > "1000")); > }, > but this doesnt append the data at all. > > I've also tried this > success: function(data){ > $('#chat_box').append(data).show("slide", {direction: "down"}, > "1000"); > }, > but this just adds the effect to the whole div instead of just the > append data. > > For the whole code visitwww.forsakenrealms.co.cc/chat/?user=1
[jQuery] Re: Limit nextAll
Assuming you are looking for div .nextAll("div:lt(2)").each(function(){}); On Aug 28, 6:55 pm, Jaggi wrote: > Basically i'm going through a table, i've used closest to get the > parent element which is a tr then i can use next() to get the next one > or nextAll() to get all the next ones however i just want to get the > next two elements so is there a way to limit nextAll() to only return > the next two matches rather than all of them?
[jQuery] Re: previous value ands remote validation
May be you should put the remote validation in field A instead of B, passing both A and B values to the server side. On Aug 26, 4:42 pm, marcp wrote: > hi all, > > i have 2 fields in my form with 1 being currently validated with a > remote method (say Field B). > I would like to make a dependency between fieldA and fieldB so i tried > to add a blur function on field A with jQuery("#FieldB").valid() > > but when i change FieldA's value no remote validation occurs because > there is a check (if value != previous value) > > is there a way for me to disable this cache ? or to reset previous > data ? > > thanks for any help. > > regards, > > marc
[jQuery] Re: jQuery Form Plugin ajax submit
To protect the input fields, use readOnly instead of disabled and the value will be included. On Aug 21, 9:39 pm, Chris Hall wrote: > Using the following code: > > $('.input_all').attr("disabled", "disabled"); > > for input texts with the class="input_all" seems to break jQuery forms > ajax submit. > > How can I fix this?
[jQuery] Re: JQuery with Crystal Reports .Net 2.0
On the server side (CR XI), export the report to PDF and stream it to the client, much less problem than using CR viewer. On Aug 26, 3:06 am, ND wrote: > Hello, > > Has anyone attempted using JQuery dialog to display crystal reports > in .Net 2.0? Also, the crystal report viewer is within and AJAX update > panel. We are trying to implement that and having nightmarish issues > with printing and exporting the reports. If I use full postbacks from > the report viewer, it closes the JQuery dialog. If I use async > postbacks, there is no event to trigger the printing. Has anyone > experienced this? > > Any help is greatly appreciated. > > Thanks, > ND
[jQuery] Re: Which event to use with form elements
Can't you use change()? >From the jquery docs. "The change event fires when a control loses the input focus and its value has been modified since gaining focus." $("form Input, form select").change(function(){ alert($(this).val()); }); If you want to detect the value before lost focus, you have to use keyup event. //The script is not tested $("form Input, form select").each(function(){ var origVal = $(this).val(); $(this).keyup(function(){ // you may want to compare the new value with the orig value from 0 to nth position if ($(this).val() != origVal) alert($(this).val()); }); }); On Aug 23, 1:42 pm, André Hänsel wrote: > Hi, > > is there any event that I can use to trigger an action immediately > when a form element is changed? (And similarily when it is changed and > then looses the focus.) > > I think JS does not provide such an event but maybe jQuery provides > some kind of "virtual event" for this case? > > Regards, > André
[jQuery] Re: :first relative to clicked element
I tested this and it works with FF3.0 and IE 8.0 $("#content").find("blockquote") .hide() .before("Click for more...") .end() .find('h5').click(function() { $(this).nextAll('blockquote:first') .slideToggle('slow') .end() .nextAll('h6:first').slideToggle('slow'); }); On Aug 21, 5:28 pm, Carl-Johan Lindqvist wrote: > Hi Jules and thanks for your reply. > > Sadly, that didn't work (though I now use your $(this).nextAll > ('blockquote:first') to select the blockquote, it looks better > than .next().next() ) > > Might the problem with the tag has something to do with the fact > that the whole More.. is added by jQuery itself; > > $('blockquote').prev().append( 'More...' ); > > ? > > Thanks again! > > On Aug 21, 6:20 am, Jules wrote: > > > $('#content').find('blockquote') > > .hide() > > .end() > > .find('h5').click(function() { > > $(this).nextAll('blockquote:first') > > .slideToggle('slow') > > .end() > > .nextAll('h6:first').slideToggle('slow'); > > }); > > > On Aug 21, 3:08 am, Carl-Johan Lindqvist > > wrote: > > > > Hi > > > > I'm just learning jQuery and have some troubles with the selectors. > > > > I'm using this (found in the basic training file) to show and hide a > > > Blockquote paragraph. > > > > $('#content').find('blockquote').hide().end().find('h5').click(function > > > () { > > > $(this).next().next().slideToggle('slow'); > > > $("h6:first").slideToggle('slow'); > > > > }); > > > > Basically I have a with a title, then a with the first > > > paragraph of text, and then I have the rest of the text wrapped in a > > > tag (this is all WordPress, that's why the syntax might > > > be a little strange). > > > Under the blockquote I have a Click for more... which I'd > > > like to hide when the blockquote is shown. > > > This is then repeated a couple of times.. something like: > > > > Title > > > Intro > > > The rest of the text > > > Click for more... > > > > Title > > > Intro > > > The rest of the text > > > Click for more... > > > > Title > > > Intro > > > The rest of the text > > > Click for more... > > > > Now the code I have works fine for the first set of lines (when I > > > click the the slides out and the slides away. > > > But "h6:first" is (apparently) relative to the whole document and not > > > to the you just clicked, so when I click the second it's the > > > in the first set that disappears. > > > > How can I write it so that only the first after the is > > > toggled? > > > > Thank you!
[jQuery] Re: :first relative to clicked element
$('#content').find('blockquote') .hide() .end() .find('h5').click(function() { $(this).nextAll('blockquote:first') .slideToggle('slow') .end() .nextAll('h6:first').slideToggle('slow'); }); On Aug 21, 3:08 am, Carl-Johan Lindqvist wrote: > Hi > > I'm just learning jQuery and have some troubles with the selectors. > > I'm using this (found in the basic training file) to show and hide a > Blockquote paragraph. > > $('#content').find('blockquote').hide().end().find('h5').click(function > () { > $(this).next().next().slideToggle('slow'); > $("h6:first").slideToggle('slow'); > > }); > > Basically I have a with a title, then a with the first > paragraph of text, and then I have the rest of the text wrapped in a > tag (this is all WordPress, that's why the syntax might > be a little strange). > Under the blockquote I have a Click for more... which I'd > like to hide when the blockquote is shown. > This is then repeated a couple of times.. something like: > > Title > Intro > The rest of the text > Click for more... > > Title > Intro > The rest of the text > Click for more... > > Title > Intro > The rest of the text > Click for more... > > Now the code I have works fine for the first set of lines (when I > click the the slides out and the slides away. > But "h6:first" is (apparently) relative to the whole document and not > to the you just clicked, so when I click the second it's the > in the first set that disappears. > > How can I write it so that only the first after the is > toggled? > > Thank you!
[jQuery] Re: invalid object initializer. Pls Help
The first parameter format for Animate should be {width:'100px'} instead of {width, '100px'} On Aug 21, 2:07 am, NotoriousWebmaster wrote: > I'm trying to animate a couple of fields in a form. When the focus > lands on field A it grows to 300px and fieldB shrinks to 100px. When > focus lands on field B, it grows to 300 and field A shrinks to 100px. > Here's my code: > > function resizeSearchAsk() { > console.log('SearchAsk'); > $('#fldA').animate({'width', '100px'}, 'slow'); > $('#fldB').animate({'width', '300px'}, 'slow'); > } > > function resizeAskSearch() { > console.log('AskSearch'); > $('#fldA').animate({'width', '300px'}, 'slow'); > $('#fldB').animate({'width', '100px'}, 'slow'); > } > > $(document).ready(function() { > console.log('ready start'); > $('#fldA').focus(resizeSearchAsk); > $('#fldB').focus(resizeAskSearch); > console.log('ready end'); > }); > > Just loading the page I get a console error in FireBug: invalid object > initializer > On this line: > > $('#fldA').animate({'width', '100px'}, 'slow'); > > Which is in the first function resizeSearchAsk(). > > I'm not getting the log msg in the ready function. > > Any idea what I'm doing wrong? I can giove you the entire file if you > want (it's not long: a test.) > > Thx, > - AAA
[jQuery] Re: Using $.ajax to post XML to an aspx page
Can't you pass the xml as a string and load it to dom on the server side? On Aug 19, 1:39 am, Karl wrote: > I'm new to using JQuery and I've been searching everywhere to be able > to post XML to a WebMethod on an aspx page in a site. I'm sure it can > be done but I just have no idea how. > > Any help would be greatly appreciated!
[jQuery] Re: how to get back the DOM element as HTML source
Use DHTML property. $("table:first")[0].outerHTML On Aug 19, 12:36 am, John wrote: > Thanks, Anurag. Let me rephrase my question. For example, I can use > the following jQuery > to get the html source of a table element > > $("table:first").html() > > The returned html source does not include the table itself, I like to > see the html source starting > from the table, for example, > > > .. > > > Is there any jQuery function for this? If not, how do I implement > this? > > Thanks in advance, > > John > On Aug 18, 2:06 am, anurag pal wrote: > > > Hi John, > > > After setting the html by using html method you have to bind the DOM > > elements using bind method. > > > Example: > > > > $(".pge").bind("click", function(e){ > > var options = {}; > > $.ajax({ > > url: "data_retrieval.php", > > cache: false, > > type: "GET", > > data: ({id : this.getAttribute('id')}), > > > success: function(html){ > > $("#slacker_detail_view").html(html); > > $('#slacker_detail_view').show('blind', options, > > 1500); > > } > > }); > > }); > > > > > Regards, > > Anurag Pal > > > On Tue, Aug 18, 2009 at 7:40 AM, John wrote: > > > > Hi, > > > > How do I get back the DOM element as HTML source using jQuery? The html > > > () method only returns the innerHTML and it does not include the UI > > > element itself. But I am more interested in converting the UI element > > > itself to HTML. > > > > Thanks in advance, > > > > Jian
[jQuery] Re: manipulate elements with filter
I am not sure what do you want to do. Assuming you want to set the new input value and a text (not the cleanest code though): $("#clickmeIMg").click(function() { var insertDataBefore = $('#tablaFormulario').find('tr:last') insertDataBefore.clone(true) .insertAfter(insertDataBefore) .find("td") .each(function() { $(this).find("input").val("new value"); $(this).find("a").text("new link"); }); }); On Aug 18, 7:21 am, Wolf wrote: > Hi, > > I need clone a row and update the elements inside of them, but i cant > update elements dynamically. > > example Jquery. > > $("#clickmeIMg").click(function(){ > var insertDataBefore = $('#tablaFormulario').find('tr:last') > > insertDataBefore.clone(true).insertAfter(insertDataBefore).find > ("td").filter(function(){ > alert($(this).html()); > > }); > > }); > > The element return 3 alerts return : > - first alert return a select > - second alert return input > - third alert return a img > > this element i can`t capture data for update new row. > i try with array and convert to array but nothing. > > any idea ? > > Example HTML > > > > onBlur="style.backgroundColor=''"> > Seleccione > <%set rsTipo = ConnInformatica.Execute("exec > tipo_consulta") > if not rsTipo.eof then > do while not rsTipo.eof > response.Write(""& ucase(trim(rsTipo("tipo"))) &"") > rsTipo.MoveNext > loop > else > response.Write("NO EXISTEN > DATOS") > end if > rsTipo.Close > Set rsTipo = Nothing%> > > > class="caja" > id="informacion0" size="88 " maxlength="50" > onBlur="style.backgroundColor=''"> > class="opacity"> >
[jQuery] Re: Could you give some advise on studying JQuery Code Source.
Are you a beginner? If you are, this web site is a good one. http://www.w3schools.com/ On Aug 17, 1:55 pm, Jackwanzai wrote: > Hi all, > > I have been using JQuery for some time, finding it very interesting > and elegant. > > I want to study the code source. But found I was confused by many > code. > > Do you have some website or books to recommend me to refer to? > > Thank you very much!
[jQuery] Re: Input position in HTML
You should use css not jquery. On Aug 13, 10:22 pm, Baalzamon wrote: > Hi, I'm making a dynamic div in a page but I'm having some doubts: > -I have an input text field and i need to get it's position (left and > top) to make the div appear near this input. $.(':INPUTNAME').css > ('left') returns me zero like 'top' does. > Is there a way to get left/top position from a static input text field > on html?? > > Thx!!
[jQuery] Re: Click() Not Working
$("td a.menu:contains('Main')").click() should work. Can you post the html? On Aug 14, 4:48 am, S2 wrote: > This doesn't work in IE or Firefox: > > $("td a.menu:contains('Main')").click(); > > This works in IE: > > $("td a.menu:contains('Main')")[0].click(); > > $("td a.menu:contains('Main')").length is 1 > > What am I doing wrong?
[jQuery] Re: Validation Error message help
Check the error message existence before adding a new error msg if ($('#'+fieldName+'-exists').length = 0) $('#username').after('' + error + ''); On Aug 12, 2:17 am, "Dave Maharaj :: WidePixels.com" wrote: > I have this script: > > $(document).ready( function() { > > $('#username').blur( function () { > > fieldName = $(this).attr('id'); > fieldValue = $(this).val(); > > $.post('/users/ajax_validate', { > field: fieldName, > value: fieldValue > }, > function(error) { > > if(error.length != 0) { > > $('#username').after(' id="'+ fieldName +'-exists">' + error + ''); > } > else { > $('#' + fieldName + '-exists').remove(); > } > }); > }); > > }); > > So when the user leaves the field it checks validation. If error it shows an > error message. Everything is working fine except if the user goes back to > the field where there was an error and does not chnge anything and leaves > the field again the error message is duplicated. > > So they enter a username peter it says "Please choose a different name" if > they go back to the username and thenleavewith out changing "peter" i now > have: > "Please choose a different name" > "Please choose a different name" > > What do I have to change / add so that only 1 message will appear? > > Thanks > > Dave
[jQuery] Re: $ajax() question
After re-reading the original post, it seems json is not required just use data:"Args="+args2 on the server side StreamReader reader = new StreamReader(Request.InputStream); string param = reader.ReadToEnd(); param = "Args=abc" assuming args2="abc" Just use split() to get the value. On Aug 11, 1:59 pm, Jules wrote: > JavaScriptSerializer is included in AJAX 1.0. It is compatible > with .NET 2.0. > > http://www.asp.net/ajax/downloads/archive/ > > You don't have to use the ajax component on your client to use it. > > On Aug 11, 1:18 pm, yi wrote: > > > Hi Jules: > > If i use old version of ASP.net, Can i Deserialize Json data? > > > thanks Jules!!! > > > On Aug 11, 3:01 pm, Jules wrote: > > > > Opps, > > > You are right, change the contentType to > > > > contentType: "application/json; charset=utf-8" > > > > here is a snippet to handle generic json in C# .NET 3.5 > > > > JavaScriptSerializer ser = new JavaScriptSerializer(); > > > StreamReader reader = new StreamReader(Request.InputStream); > > > object input = ser.DeserializeObject(reader.ReadToEnd()); > > > string args = ((Dictionary)input)["Args"] as string; > > > > or if you have the object defined use > > > > System.Runtime.Serialization.Json.DataContractJsonSerializer > > > > More info in > > > >http://www.west-wind.com/WebLog/posts/218001.aspx > > > > On Aug 11, 12:23 pm, yi wrote: > > > > > hi Jules: > > > > I use Request("Arg") , but it doesn't work. it always give me empty > > > > string > > > > contentType: "text" is it right? > > > > do i need make it contentType: "Json", ? > > > > If i need use JSON, do you know how to read json data at sever side in > > > > asp.net? > > > > thanks so much!!! > > > > > On Aug 11, 12:50 pm, Jules wrote: > > > > > > Use Request("Arg") instead, this syntax gets the Arg from data post or > > > > > querystring. > > > > > Do not enclose args2, the server will get "args2" instead of the value > > > > > of args2. > > > > > > data:{Arg:args2} > > > > > > On Aug 11, 10:12 am, yi wrote: > > > > > > > Hi Jules: > > > > > > thank you for your help!! > > > > > > if I use this: > > > > > > > type: "POST", > > > > > > url: "mywebpage.aspx, > > > > > > data:{Arg:"args2"} > > > > > > > Do you know how can i get value of arg from sever side(code > > > > > > behind)? I > > > > > > use asp.net, but i dont know how to fatch data when data put inside > > > > > > {}, " data:{Arg:"args2"} " > > > > > > Can i still use "Request.QueryString()" function? > > > > > > > thanks > > > > > > > On Aug 11, 10:56 am, Jules wrote: > > > > > > > > There is a limit on url length depending on the browser. > > > > > > > >http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/g... > > > > > > > > use type:"POST" and data: instead and do not enclose the object > > > > > > > declaration > > > > > > > > data:{Arg:args2} instead of data:"{Arg:args2}" > > > > > > > > On Aug 11, 8:41 am, yi wrote: > > > > > > > > > $.ajax({ > > > > > > > > > type: "POST", > > > > > > > > > url: "mywebpage.aspx? > > > > > > > > Arg="+args2, > > > > > > > > > contentType: "text", > > > > > > > > > data:"{}", > > > > > > > > > dataType: "text", > > > > > > > > > success: CompleteInsert, > > > > > > > > > error: onFail > > > > > > > > > }); > > > > > > > > > I dont know why the onFail function is going to be executed > > > > > > > > when args2 > > > > > > > > is too big. > > > > > > > > args2 is a string type > > > > > > > > can anyone explain this > > > > > > > > thanks
[jQuery] Re: $ajax() question
JavaScriptSerializer is included in AJAX 1.0. It is compatible with .NET 2.0. http://www.asp.net/ajax/downloads/archive/ You don't have to use the ajax component on your client to use it. On Aug 11, 1:18 pm, yi wrote: > Hi Jules: > If i use old version of ASP.net, Can i Deserialize Json data? > > thanks Jules!!! > > On Aug 11, 3:01 pm, Jules wrote: > > > Opps, > > You are right, change the contentType to > > > contentType: "application/json; charset=utf-8" > > > here is a snippet to handle generic json in C# .NET 3.5 > > > JavaScriptSerializer ser = new JavaScriptSerializer(); > > StreamReader reader = new StreamReader(Request.InputStream); > > object input = ser.DeserializeObject(reader.ReadToEnd()); > > string args = ((Dictionary)input)["Args"] as string; > > > or if you have the object defined use > > > System.Runtime.Serialization.Json.DataContractJsonSerializer > > > More info in > > >http://www.west-wind.com/WebLog/posts/218001.aspx > > > On Aug 11, 12:23 pm, yi wrote: > > > > hi Jules: > > > I use Request("Arg") , but it doesn't work. it always give me empty > > > string > > > contentType: "text" is it right? > > > do i need make it contentType: "Json", ? > > > If i need use JSON, do you know how to read json data at sever side in > > > asp.net? > > > thanks so much!!! > > > > On Aug 11, 12:50 pm, Jules wrote: > > > > > Use Request("Arg") instead, this syntax gets the Arg from data post or > > > > querystring. > > > > Do not enclose args2, the server will get "args2" instead of the value > > > > of args2. > > > > > data:{Arg:args2} > > > > > On Aug 11, 10:12 am, yi wrote: > > > > > > Hi Jules: > > > > > thank you for your help!! > > > > > if I use this: > > > > > > type: "POST", > > > > > url: "mywebpage.aspx, > > > > > data:{Arg:"args2"} > > > > > > Do you know how can i get value of arg from sever side(code behind)? I > > > > > use asp.net, but i dont know how to fatch data when data put inside > > > > > {}, " data:{Arg:"args2"} " > > > > > Can i still use "Request.QueryString()" function? > > > > > > thanks > > > > > > On Aug 11, 10:56 am, Jules wrote: > > > > > > > There is a limit on url length depending on the browser. > > > > > > >http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/g... > > > > > > > use type:"POST" and data: instead and do not enclose the object > > > > > > declaration > > > > > > > data:{Arg:args2} instead of data:"{Arg:args2}" > > > > > > > On Aug 11, 8:41 am, yi wrote: > > > > > > > > $.ajax({ > > > > > > > > type: "POST", > > > > > > > > url: "mywebpage.aspx? > > > > > > > Arg="+args2, > > > > > > > > contentType: "text", > > > > > > > > data:"{}", > > > > > > > > dataType: "text", > > > > > > > > success: CompleteInsert, > > > > > > > > error: onFail > > > > > > > > }); > > > > > > > > I dont know why the onFail function is going to be executed when > > > > > > > args2 > > > > > > > is too big. > > > > > > > args2 is a string type > > > > > > > can anyone explain this > > > > > > > thanks
[jQuery] Re: $ajax() question
Opps, You are right, change the contentType to contentType: "application/json; charset=utf-8" here is a snippet to handle generic json in C# .NET 3.5 JavaScriptSerializer ser = new JavaScriptSerializer(); StreamReader reader = new StreamReader(Request.InputStream); object input = ser.DeserializeObject(reader.ReadToEnd()); string args = ((Dictionary)input)["Args"] as string; or if you have the object defined use System.Runtime.Serialization.Json.DataContractJsonSerializer More info in http://www.west-wind.com/WebLog/posts/218001.aspx On Aug 11, 12:23 pm, yi wrote: > hi Jules: > I use Request("Arg") , but it doesn't work. it always give me empty > string > contentType: "text" is it right? > do i need make it contentType: "Json", ? > If i need use JSON, do you know how to read json data at sever side in > asp.net? > thanks so much!!! > > On Aug 11, 12:50 pm, Jules wrote: > > > > > > > Use Request("Arg") instead, this syntax gets the Arg from data post or > > querystring. > > Do not enclose args2, the server will get "args2" instead of the value > > of args2. > > > data:{Arg:args2} > > > On Aug 11, 10:12 am, yi wrote: > > > > Hi Jules: > > > thank you for your help!! > > > if I use this: > > > > type: "POST", > > > url: "mywebpage.aspx, > > > data:{Arg:"args2"} > > > > Do you know how can i get value of arg from sever side(code behind)? I > > > use asp.net, but i dont know how to fatch data when data put inside > > > {}, " data:{Arg:"args2"} " > > > Can i still use "Request.QueryString()" function? > > > > thanks > > > > On Aug 11, 10:56 am, Jules wrote: > > > > > There is a limit on url length depending on the browser. > > > > >http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/g... > > > > > use type:"POST" and data: instead and do not enclose the object > > > > declaration > > > > > data:{Arg:args2} instead of data:"{Arg:args2}" > > > > > On Aug 11, 8:41 am, yi wrote: > > > > > > $.ajax({ > > > > > > type: "POST", > > > > > > url: "mywebpage.aspx? > > > > > Arg="+args2, > > > > > > contentType: "text", > > > > > > data:"{}", > > > > > > dataType: "text", > > > > > > success: CompleteInsert, > > > > > > error: onFail > > > > > > }); > > > > > > I dont know why the onFail function is going to be executed when args2 > > > > > is too big. > > > > > args2 is a string type > > > > > can anyone explain this > > > > > thanks
[jQuery] Re: (Validate) Error messages in Summary section
Check out errorLabelContainer http://docs.jquery.com/Plugins/Validation/validate#toptions On Aug 10, 9:32 pm, "dazad...@gmail.com" wrote: > Hi, > > I'm new to jQuery and the validation plugin, I just wondered if it is > possible to get the error messages to be shown in an error summary > section instead of inline? > > Cheers, > > Daz
[jQuery] Re: $ajax() question
Use Request("Arg") instead, this syntax gets the Arg from data post or querystring. Do not enclose args2, the server will get "args2" instead of the value of args2. data:{Arg:args2} On Aug 11, 10:12 am, yi wrote: > Hi Jules: > thank you for your help!! > if I use this: > > type: "POST", > url: "mywebpage.aspx, > data:{Arg:"args2"} > > Do you know how can i get value of arg from sever side(code behind)? I > use asp.net, but i dont know how to fatch data when data put inside > {}, " data:{Arg:"args2"} " > Can i still use "Request.QueryString()" function? > > thanks > > On Aug 11, 10:56 am, Jules wrote: > > > There is a limit on url length depending on the browser. > > >http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/g... > > > use type:"POST" and data: instead and do not enclose the object > > declaration > > > data:{Arg:args2} instead of data:"{Arg:args2}" > > > On Aug 11, 8:41 am, yi wrote: > > > > $.ajax({ > > > > type: "POST", > > > > url: "mywebpage.aspx? > > > Arg="+args2, > > > > contentType: "text", > > > > data:"{}", > > > > dataType: "text", > > > > success: CompleteInsert, > > > > error: onFail > > > > }); > > > > I dont know why the onFail function is going to be executed when args2 > > > is too big. > > > args2 is a string type > > > can anyone explain this > > > thanks
[jQuery] Re: refactoring help/ suggestions?
Assuming your html format as follows: Para a Paragraph a Para b Paragraph b Para c Paragraph c Use this: $(document).ready(function() { $("a.p").next("p").hide(); $("a.p").hover(function() { $(this).fadeOut("slow").fadeIn("slow"); var par = $(this).next("p"); if (par.is(":hidden")) par.fadeIn("slow"); else par.fadeOut("sloe"); }); }); On Aug 11, 3:52 am, Calvin wrote: > Here is a solution I came up with, but there is still some repeated > code. Does anyone have any suggestions I could try out to 'DRY' up my > code? > > jQuery.fn.swapFade = function() { > if (this.is(':hidden')) { > this.fadeIn('slow'); > } else { > this.fadeOut('slow'); > } > > }; > > $(document).ready(function() { > $('p.a, p.b, p.c').hide(); > var hash = {'one': 'a', 'two': 'b', 'three': 'c'} > > $('.one').hover(function() { > $('a.one').fadeOut('slow').fadeIn('slow'); > $('p.' + hash[this.className]).swapFade(); > > return false; > }); > > $('.two').hover(function() { > $('a.two').fadeOut('slow').fadeIn('slow'); > $('p.' + hash[this.className]).swapFade(); > > return false; > }); > > $('.three').hover(function() { > $('a.three').fadeOut('slow').fadeIn('slow'); > $('p.' + hash[this.className]).swapFade(); > > return false; > }); > > }); > > On Aug 9, 11:51 am, Calvin wrote: > > > Hi, > > > I wrote this code for a simple "hide and show" effect and I am looking > > for any advice or examples of how I can refactor the code. I tried > > using a hash but it didn't work out right and I am thinking that maybe > > I should make a object method. > > > here is the code: > > > $(document).ready(function() { > > var $firstPara = $('p.a'); > > $firstPara.hide(); > > > $('a.one').hover(function() { > > $('a.one').fadeOut('slow').fadeIn('slow'); > > > if ($firstPara.is(':hidden')) { > > $firstPara.fadeIn('slow'); > > } else { > > $firstPara.fadeOut('slow'); > > } > > return false; > > > }); > > }); > > > $(document).ready(function() { > > var $secondPara = $('p.b'); > > $secondPara.hide(); > > > $('a.two').hover(function() { > > $('a.two').fadeOut('slow').fadeIn('slow'); > > > if ($secondPara.is(':hidden')) { > > $secondPara.fadeIn('slow'); > > } else { > > $secondPara.fadeOut('slow'); > > } > > return false; > > > }); > > }); > > > $(document).ready(function() { > > var $thirdPara = $('p.c'); > > $thirdPara.hide(); > > > $('a.three').hover(function() { > > $('a.three').fadeOut('slow').fadeIn('slow'); > > > if ($thirdPara.is(':hidden')) { > > $thirdPara.fadeIn('slow'); > > } else { > > $thirdPara.fadeOut('slow'); > > } > > return false; > > > }); > > });
[jQuery] Re: $ajax() question
There is a limit on url length depending on the browser. http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/get/url-parameters.html use type:"POST" and data: instead and do not enclose the object declaration data:{Arg:args2} instead of data:"{Arg:args2}" On Aug 11, 8:41 am, yi wrote: > $.ajax({ > > type: "POST", > > url: "mywebpage.aspx? > Arg="+args2, > > contentType: "text", > > data:"{}", > > dataType: "text", > > success: CompleteInsert, > > error: onFail > > }); > > I dont know why the onFail function is going to be executed when args2 > is too big. > args2 is a string type > can anyone explain this > thanks
[jQuery] Re: Custom Attributes - Beginner tip
I think that is one of the reason to use class, It is "cleaner" than using custom attributes. May be others can share their experiences on XHTML and custom attributes? On Aug 6, 1:37 am, "Cesar Sanz" wrote: > What happens with custom attributes regarding the strict XHTML format? > > - Original Message - > From: "Rick Faircloth" > To: > Sent: Wednesday, August 05, 2009 5:12 AM > Subject: [jQuery] Re: Custom Attributes - Beginner tip > > > Thanks for the tip! > > > -Original Message- > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > Behalf Of Miket3 > > Sent: Tuesday, August 04, 2009 8:04 PM > > To: jQuery (English) > > Subject: [jQuery] Custom Attributes - Beginner tip > > > One issue I ran across while learning jquery was that I often wanted/ > > needed a way to tell jquery to get data for the current element from a > > related element. jQuery immediately tends to be friendly when you need > > to work with a class of elements via the CLASS attribute, or a > > specific element via the ID attribute. However, when there are 2 > > elements that are related but do not fit within a class, a beginner > > such as myself may have a little trouble trying to find the best way > > to handle this issue. At this point we begin to research how to get > > jQuery to recognize a custom attribute, because common rules says that > > the ID attrib is basically out of the question as this needs to be > > unique to each element. And the CLASS attrib just doesn't logically > > help either because it can refer to too many other elements that don't > > fit our rule. And when we find out that jQuery doesn't readily > > recognize custom attributes it can get a little intimidating because > > one of the solutions is to extend jQuery. But there are a couple of > > other standard attributes that are recognized but rarely used. In my > > particular case I started using the TITLE attribute for relating my > > elements. But then I stumbled upon the correct way, (or at least until > > someone corrects me on this post). There is a REL attribute which can > > be used to RELATE the to elements. So when you feel like you need a > > custom attribute, you might not need one, the REL is available and the > > TITLE could be used as a backup if necessary. > > > I hope this helps someone.
[jQuery] Re: Custom Attributes - Beginner tip
jQuery support custom attributes, may be you can post a sample? Anyway, this works $(document).ready(function(){ alert($("[custom='test']").length); }); On Aug 5, 10:04 am, Miket3 wrote: > One issue I ran across while learning jquery was that I often wanted/ > needed a way to tell jquery to get data for the current element from a > related element. jQuery immediately tends to be friendly when you need > to work with a class of elements via the CLASS attribute, or a > specific element via the ID attribute. However, when there are 2 > elements that are related but do not fit within a class, a beginner > such as myself may have a little trouble trying to find the best way > to handle this issue. At this point we begin to research how to get > jQuery to recognize a custom attribute, because common rules says that > the ID attrib is basically out of the question as this needs to be > unique to each element. And the CLASS attrib just doesn't logically > help either because it can refer to too many other elements that don't > fit our rule. And when we find out that jQuery doesn't readily > recognize custom attributes it can get a little intimidating because > one of the solutions is to extend jQuery. But there are a couple of > other standard attributes that are recognized but rarely used. In my > particular case I started using the TITLE attribute for relating my > elements. But then I stumbled upon the correct way, (or at least until > someone corrects me on this post). There is a REL attribute which can > be used to RELATE the to elements. So when you feel like you need a > custom attribute, you might not need one, the REL is available and the > TITLE could be used as a backup if necessary. > > I hope this helps someone.
[jQuery] Re: Show/hide on radio button click
This should works not sure about the performance though $(function() { $('p').next('ul').hide(); //hide donation choice children $('input[name="donate_by"]').click(function() { //donation choice radio button click $(this).next().css('font-weight','bold'); $(this).parent().siblings('p').children('label').css('font- weight','normal'); $(this).parent().next().slideDown(); $(this).parent().siblings('p').next('ul').slideUp(); }); }); On Aug 5, 10:52 am, Magnificent wrote: > Hi all, > > I'm trying to do a show/hide on a radio button click and I do have it > working, but I'd like to make it more...extensible/independent of hard- > coding children elements to show hide. My dummy html structure is: > > id="cause">By Cause: > > Please select cause(s) below: > Cause 1 > Cause 2 > Cause 3 > > > id="foundation">By Foundation: > > Foundation 1 > Foundation 2 > Foundation 3 > > > My jquery code is: > > $(function() { > $('#cause_children, #foundation_children').hide(); //hide donation > choice children > > $('input[name="donate_by"]').click(function() { //donation choice > radio button click > //$(this).next().css('border', '1px solid blue'); > //$(this).next().find('ul:first').css('border', '1px solid > red'); > //$(".donation_children").slideToggle('slow'); > > switch ( $(this).val() ) { > case 'by_cause' : //if by cause, show cause, hide > foundation > $(this).next().css('font-weight', 'bold'); > //bold cause > $('#foundation').next().css('font-weight', > 'normal')//unbold > foundation > $('#cause_children').slideDown(); > $('#foundation_children').slideUp(); > break; > case 'by_foundation' : //if by foundation, show > foundation, hide > cause > $(this).next().css('font-weight', 'bold'); > //bold foundation > $('#cause').next().css('font-weight', > 'normal')//unbold cause > $('#cause_children').slideUp(); > $('#foundation_children').slideDown(); > break; > } > > }); > > }); > > I left some commented out stuff at the top of the function, hopefully > to give you an idea of what I tried. In particular: > > $(this).next().find('ul:first').css('border', '1px solid red'); > I was trying to get the first ul (the children to show/hide) on > "this" (the radio button clicked). > > I'd like this to be flexible to where you could add more radio button/ > children and as long as the structure stays the same, the show/hide > functionality works.
[jQuery] Re: xpath not returning objects
jQuery does not recognise @ as attribute indicator. Just remove the @ from your code and enclose the attribute value with ': $("input:checkbox[name='media_type']").click(function() { if (this.checked == true) { alert('checkbox true'); $("div[class='mediafield']").hide ('fast'); }); On Aug 5, 7:55 am, Old Orange Juice wrote: > I have a bunch of divs with the same classname, 'mediafield': > > Slug: > Big Blurb(Video) > Big Blub(short content) > > Big Blub(Audio) > Photo Uri(images): > > and I have this jquery code in my header: > > $(document).ready(function() { > $("input:checkb...@name=media_type]").click(function() { > if (this.checked == true) { > alert('checkbox true'); > $("d...@class=mediafield]").hide('fast'); > > });}); > > > > So I know that the click function is getting implemented.. The alert > box appears however I get the following error in firebug: > uncaught exception: Syntax error, unrecognized expression: > [...@class=mediafield] > > Line 0 > > Nothing happens when firebug is turned off... So I'm not sure why it's > throwing the error. > > Any help? > > Thanks, > ooj
[jQuery] Re: How to show a div upon a validation error?
Hopefully this help. -- html Error text for field1 -- script var options = { errorPlacement: function(error, element) { $("label[for='" + element[0].id + "']").addClass (this.errorClass).show(); } }; $("form").validate(options); On Jul 31, 2:11 am, Rudi Cheow wrote: > Hi all, > > Please see this code: > > > > Error1 > > Error2 > > > The above is a simplified version of my code, but it shows enough. The > two DIVs are set to "display:none". > > How do I invoke the validate plugin in such a way that it shows the > appropriate DIV when validation fails on the relevant field? > > I have been pulling my hair out over this, and the fact that this is > my first serious foray into jQuery territory doesn't help. > > Any assistance appreciated. > > Thanks.
[jQuery] Re: A few novice questions on Datepicker
Most of your questions can be answered by the date picker docs http://docs.jquery.com/UI/Datepicker 1. Use minDate option 2. If I correctly understand the question, use dateFormat option 3. .ui-icon-circle-triangle-e and .ui-icon-circle-triangle-w. This website allow you to change the ui theme http://jqueryui.com/themeroller/ On Jul 31, 9:03 am, wei wrote: > I just plug in the JQuery into my Spring application. It looks great. > I have a few questions in the regards: > > 1. how to configure the Datepicker so that only the current and future > date can be picked? > 2. how to let the initial date shown as the date format used in the > field? > 3. what are the forward and backward arrow icon names? I make a very > minor modification on the CSS file so that the datepicker will popup > on top of my page. I can't find the arrow icon names in the CSS file. > > Thanks.
[jQuery] Re: fn question
>From the jquery plugin http://docs.jquery.com/Plugins/Authoring Your method must return the jQuery object, unless explicity noted otherwise. $('input#btn').btnClick().css("background-color","blue") won't work for your 1st case but works for the 2nd one. On Jul 30, 3:14 pm, "David .Wu" wrote: > I found these both work, so what is return for? > > > $.fn.btnClick = function() { > this.click(function() { > alert('test'); > }); > > } > > $('input#btn').btnClick(); > > > > $.fn.btnClick = function() { > return this.click(function() { > alert('test'); > }); > > } > > $('input#btn').btnClick(); >
[jQuery] Re: jQuery Nesting Tables
As mentioned by FrenchiINLA, $("table tr:has(table)") or $(".list tr:has(table)") should do it. On Jul 29, 5:04 am, nullstring wrote: > Hi, > > am not sure if I'm doing this right .. > > I have here the function to move the paging from GridView(table) > generated by .NET, on top/before the table(GridView), and put it > inside the DIV element. > > Problem is, the condition there: > if($('tbody tr:last td:has(table)', this).length > 0) > doesn't work. > > I have provided a simplier table and expected result at the bottom. > > - JQuery Code : Start > --- > > jQuery.fn.CreatePagingOnTop = function() { > if(jQuery(this).is('table')) { > if($('tbody tr:last td:has(table)', this).length > 0) { // > need to check if the paging table exists in the last row of the table > this.before(''); > this.find('tbody tr:last').remove().appendTo($("#pages")); > } > } > > return this; > > } > > $(document).ready(function() > { > // let's remove our paging and create > // DIV element on top of table element and move the paging > there.. > $("#scrollTable").CreatePagingOnTop(); > > }); > > - JQuery Code : END > --- > > - HTML: Table problem, simplified : Start > --- > > > > head 1 > head 2 > > > > col 1 r1 > col 2 r1 > > > col 1 r2 > col 2 r2 > > > > > > > 1 > 2 > > > > > > > > - HTML: Table problem, simplified : END > --- > > - HTML: Expected result : Start > > > > > > 1 > 2 > > > > > > head 1 > head 2 > > > > col 1 r1 > col 2 r1 > > > col 1 r2 > col 2 r2 > > > > > - HTML: Expected result : Start > > > - HTML: Result if no condition and no Page links table : Start > - > > > > > col 1 r2 > col 2 r2 > > > > > > head 1 > head 2 > > > > col 1 r1 > col 2 r1 > > > > > - HTML: Result if no condition and no Page links table : END > - > > Please?
[jQuery] Re: (validate) multiple error error messages per input
I tested your HTML using IE and FF in both cases the error message is only displayed once using jquery.1.3.2 and validate 1.5.4. Try to step through the validate code to find the error. BTW, it is a good idea to close your input tag On Jul 30, 1:03 am, jckos wrote: > Thanks for the reply. > > My form looks like what you describe, but I still have the problem > > > shipping address > class="labelRequired">first name * small>: > tabindex="1" value="" title="" class="required"> > last name > class="labelRequired">*: > title="last name" class="required"> > class="labelRequired">company: LABEL> > title="company"> > class="labelRequired">street address * small> > tabindex="4" title="street address" class="required"> > class="labelRequired">address line 2: > tabindex="5" title="address line 2"> > class="labelRequired">city *: LABEL> > title="city" > class="required"> > > > On Jul 27, 9:07 pm, Jules wrote: > > > Since you didn't post your html and code, I would guess you don't have > > name property specified on your html. > > > > > > should be > > > > > > On Jul 28, 8:26 am, jckos wrote: > > > > Hi, > > > > If I focus on a field multiple times or submit the form multiple > > > times, I the script adds multiple error messages per field, both valid > > > and error classes, depending on the data entered. > > > > Any suggestions? > > > > Thanks, > > > > John
[jQuery] Re: small problem
Using Vista 64 FF3.0.1 the letters change to yellow as mentioned. Works fine in IE 8 On Jul 26, 7:40 pm, GaVrA wrote: > Hmm check out my site: > > http://www.crtaci.info/ > > on top-right position i have search field. When you move your mouse > over there small text shows up that says: > > Napredna pretraga > > Now, for some reason those letters change color to like yellow for > very short period of time in ff 3.5 and to some strange color in > safari 4.0.2 for win. In ie8, opera and chrome it works just the way > it should, white letters stay white during the animation. > > Any sugestions?
[jQuery] Re: JQuery method to update one form element with value from another
Try the most obvious method: '("#hiddenfieldId").val(' or '("#hiddenfieldId")[0].value =' or '("#hiddenfieldId").get(0).value =' assuming the hidden field is as specified below and the coder using uniqueid. If the code cannot be found, the original coder may use class name or other attributes. Good luck, modifying a 4000+ lines of code web page is a very challenging task On Jul 28, 7:38 am, OccasionalFlyer wrote: > I need to make a change to a web page that has lots of JQuery > things in it, it appears. Not knowing anything about the actual use > of JQuery, however, while I will start looking at the doc, can someone > help me with what to look for in a 4000+ line file to find out where > the value is being set for the hidden field. I have been unable to > identify this. There appears to be no onChange or onSubmit JavaScript > call. I have been given this file with the need to figure this out > right away, with a very tight timeline to make many changes, so this > one item can't take the time required to start learning the whole of > JQuery before I can make a change. Thanks.
[jQuery] Re: (validate) multiple error error messages per input
Since you didn't post your html and code, I would guess you don't have name property specified on your html. should be On Jul 28, 8:26 am, jckos wrote: > Hi, > > If I focus on a field multiple times or submit the form multiple > times, I the script adds multiple error messages per field, both valid > and error classes, depending on the data entered. > > Any suggestions? > > Thanks, > > John
[jQuery] Re: Need help with a custom selector to bind ajax callbacks
Opps, Sorry, didn't realise request and settings are not available on ajaxSend and ajaxStop. So, my proposed solution is not working. May be a dumber solution var isFaceBox = true; $(document).ready(function(){ $(document).ajaxSend(function(event){ if(!isFaceBox) { $('body > div.container').fadeTo('normal', 0.33); $('#loading').show(); } }); $(document).ajaxComplete(function(event){ if(!isFaceBox) { $('body > div.container').fadeTo('normal', 1); $('#loading').hide(); } }); $.ajax({ //your call beforeSend: function(){ isFaceBox = false;}, complete: function(){ isFaceBox = true;} }); }); On Jul 24, 10:02 am, Jules wrote: > Can't you check the settings.url? > > $(document).ready(function(){ > $(document).ajaxSend(function(event, request, settings){ > if(settings.url != 'faceboxurl') // replace faceboxurl with the > real url > { > $('body > div.container').fadeTo('normal', 0.33); > $('#loading').show(); > } > }); > $(document).ajaxComplete(function(event, request, settings){ > if(settings.url != 'faceboxurl') // replace faceboxurl with the > real url > { > $('body > div.container').fadeTo('normal', 1); > $('#loading').hide(); > } > }); > > }); > > On Jul 24, 6:05 am, Rodrigo Tassinari wrote: > > > Anyone? > > > On 20 jul, 12:34, Rodrigo Tassinari de Oliveira > > > wrote: > > > Hello everyone, > > > > I'm stuck with an annoying problem in this webapp I'm developing. > > > > I've created a small code to be called automagically on every ajax > > > request, which shows a "loading..." div overlay while the ajax request > > > is being processed. This works fine, and the code used can be seen in > > > this pastie: > > > >http://pastie.org/552179 > > > > However, we also use the Facebox plugin (http://famspam.com/facebox/) > > > in this app, and we don't want the "loading..." div overlay to show > > > when a facebox ajax request is triggered (the example link trigger is > > > also on the above pastie), since facebox has it's on "loading" thing. > > > > I can't seem to do that. I binding the ajaxSend and ajaxComplete > > > callbacks to some css selector that would include everything except > > > the facebox links (a[rel*=facebox]), instead of the current $ > > > (document) route, but I failed. > > > > Does anyone have any ideas to help me with this? > > > > Thanks a lot in advance, > > > Rodrigo.
[jQuery] Re: [validate]
Validation is triggerd by 4 events that are active by default: Submit KeyUp Change Click -- for check box and radio button To prevent KeyDown and LostFocus validation use the following options onkeyup:false, onfocusout:false, onclick:false This information is available on the validate options doc. http://docs.jquery.com/Plugins/Validation/validate#toptions So, unless you are disabling the change event, your select should be re-validated on change event. Could you post your code? On Jul 24, 2:56 am, "dustin.c" wrote: > Hi all, > I'm using the jQuery validate plugin. When select boxes don't pass > validation, I want them to to be revalidated onChange. I don't see an > option for this in the validate() options. Do I have to add it > manually to the elements onchange attribute? > -Dustin
[jQuery] Re: Need help with a custom selector to bind ajax callbacks
Can't you check the settings.url? $(document).ready(function(){ $(document).ajaxSend(function(event, request, settings){ if(settings.url != 'faceboxurl') // replace faceboxurl with the real url { $('body > div.container').fadeTo('normal', 0.33); $('#loading').show(); } }); $(document).ajaxComplete(function(event, request, settings){ if(settings.url != 'faceboxurl') // replace faceboxurl with the real url { $('body > div.container').fadeTo('normal', 1); $('#loading').hide(); } }); }); On Jul 24, 6:05 am, Rodrigo Tassinari wrote: > Anyone? > > On 20 jul, 12:34, Rodrigo Tassinari de Oliveira > > wrote: > > Hello everyone, > > > I'm stuck with an annoying problem in this webapp I'm developing. > > > I've created a small code to be called automagically on every ajax > > request, which shows a "loading..." div overlay while the ajax request > > is being processed. This works fine, and the code used can be seen in > > this pastie: > > >http://pastie.org/552179 > > > However, we also use the Facebox plugin (http://famspam.com/facebox/) > > in this app, and we don't want the "loading..." div overlay to show > > when a facebox ajax request is triggered (the example link trigger is > > also on the above pastie), since facebox has it's on "loading" thing. > > > I can't seem to do that. I binding the ajaxSend and ajaxComplete > > callbacks to some css selector that would include everything except > > the facebox links (a[rel*=facebox]), instead of the current $ > > (document) route, but I failed. > > > Does anyone have any ideas to help me with this? > > > Thanks a lot in advance, > > Rodrigo.
[jQuery] Re: Customize Error Labels
This should work instead of going through all labels. $('form').validate({ errorPlacement: function(error, element) { $('label[for="' + $(element).attr('id') + '"]').addClass('error'); }); } }); On Jul 23, 4:00 pm, Rizky wrote: > Ahh, > > Thx for the reply. I get it now :) > But my labels isn't always the previous element before the fields. So > I changed it to suit my markup. Like this: > > $('form').validate({ > errorPlacement: function(error, element) { > $('label').each(function() { > var field_for = $(this).attr('for'); > var field_id = $(element).attr('id'); > if (field_for == field_id) { > $(this).addClass('error'); > } > }); > } > > }); > > Nothing fancy, but it works... > > Btw, thx for the help.. > > On Jul 23, 12:17 pm, Jules wrote: > > > Read errorPlacement on validate docs. > > > $(document).ready(function() { > > $("form").validate({ > > errorPlacement: function(error, element) { > > $(element).prev().addClass("error"); > > } > > }); > > }); > > > Input: > class="required" /> > > > On Jul 23, 3:03 pm, Rizky wrote: > > > > Hi, > > > > I need help with the Validation plugin. I want to disable the > > > generated error labels and I need to find a way to add the class > > > "error" to existing form labels instead. Currently I don't use it and > > > simply want to add highlighting to the existing fields and labels. > > > > My forms already contain fields with corresponding labels (using the > > > basic "for" - "id" relationship). And all i need to do now is to add > > > the class "error" to these labels if the corresponding fields has > > > errors. > > > > Sorry if this question have been asked before. > > > > Thx
[jQuery] Re: Customize Error Labels
Read errorPlacement on validate docs. $(document).ready(function() { $("form").validate({ errorPlacement: function(error, element) { $(element).prev().addClass("error"); } }); }); Input: On Jul 23, 3:03 pm, Rizky wrote: > Hi, > > I need help with the Validation plugin. I want to disable the > generated error labels and I need to find a way to add the class > "error" to existing form labels instead. Currently I don't use it and > simply want to add highlighting to the existing fields and labels. > > My forms already contain fields with corresponding labels (using the > basic "for" - "id" relationship). And all i need to do now is to add > the class "error" to these labels if the corresponding fields has > errors. > > Sorry if this question have been asked before. > > Thx
[jQuery] Re: jQuery validation custom method doesn't work
Your code should have been: $.validator.addMethod('myEqual', function (value, element, param) { return value >= $(param).val(); // this works know }, 'Please enter a greater year!'); On Jul 23, 12:21 pm, Erwin Purnomo wrote: > Hello all > > I have added a method on jQuery validator like this > > $.validator.addMethod('myEqual', function (value, element) { > return value == element.value; // this one here didn't work :( > }, 'Please enter a greater year!'); > > $.metadata.setType("attr", "validate"); > > $("#educationForm").validate({ > showErrors: function(errorMap, errorList) { > > this.defaultShowErrors(); > }, > errorPlacement: function(error, element) { > error.appendTo( element.parent("td").next > ("td") ); > }, > /*success: function(label) { > label.text("ok!").addClass("success"); > },*/ > rules: { > txt_end: { > required: true, > myEqual: "#txt_begin" > } > }, > submitHandler: function() { > } > }); > > the form looks like this > > > action=""> > > > Period: > id="txt_begin" size="8" maxlength="4" class="required year ui-widget- > content ui-corner-all" /> to > maxlength="4" class="required year ui-widget-content ui-corner-all" /> > > > > > > value="Submit" class="ui-button ui-state-default ui-corner-all" /> > value="Cancel" class="ui-button ui-state-default ui-corner-all" /> > > > > > > > > but why the custom method I added didn't work? > > return value == element.value; // this one here didn't work :( > > it always return true for any value :( am I missing something here? I > didn't use the built in method because later in the form I would > require to write another method to check for greater or equal and > lower or equal ( ">=" and "<=" ) I have tested this method with > greater or equal and lower or equal by replacing the "==" with ">=" or > with "<=" It didn't work either
[jQuery] Re: Jquery Validation How To
The validation is only triggered during submit event which is fine to me. I don't like interactive validation as it creates distraction to the users. $("form").validate( { errorLabelContainer: "#errMsg", wrapper: "li" }); $("#phoneCount").rules("add", { min: 1, messages: { min: 'A contact number is required.' } }); $("#business, #fax, #cell, #home").change(function() { if ($(this).val() != '') changeCounter(this,1); else changeCounter(this,-1); }); }); function changeCounter(calleer, i) { var curVal = parseInt($("#phoneCount")[0].value,10); $("#phoneCount")[0].value = curVal + i; } Business: Home: Cell: Fax: On Jul 23, 3:19 am, kmac wrote: > Hi, > > I have a form that includes four text fields for phone numbers: > Business, Home, Cell and Fax > > A user must fill in at least one phone number. > > How would I set up the validation for this? > > Cheers
[jQuery] Re: extend an Object
Something like this? function person(name, address) { this.name = name; this.address = address; this.whoAmI = function() { if (this.creditLimit) alert(this.name + ' address:' + this.address + 'credit limit:' + this.creditLimit); else alert(this.name + ' address:' + this.address); } return this; } function customer() { this.creditLimit = 0; this.creditCheck = creditCheck; return this; function creditCheck() { alert(this.creditLimit); } } var a = new person('john smith', '10 main st'); var cust = new customer(); a.whoAmI(); $.extend(a, cust); a.creditLimit = 1000; a.whoAmI(); On Jul 22, 10:02 pm, jeanluca wrote: > Hi All > > I tried to add functions to an object like > > function User(n, a) { > this.name = n ; > this.aux = a ; > } > function auxis() { > alert(this.aux); > } > > $(document).ready( function() { > var u = new User("Jack") ; > u.extend({ > whoami: function() { alert(this.name); }, > autis: auxis > }) ; > u.whoami() ; > > }) ; > > Eventually I will have 2 object A and B and I want to merge A into B: > > B.exend(A) ; > > However it doesn't work at all. Any suggestions how to fix this ?
[jQuery] Re: Caching jQuery objects
I found out that jquery.validate code uses the form object to store global variables. Taking clue from the code, I uses the document object $.data($(document)[0], 'myData', myData). Not sure if this is the best practice, may be others can shed some light to the best practice to store global variables. On Jul 21, 8:51 pm, north wrote: > Hi, > > I just created a little widget using jQuery. The code is kinda ugly, > but I'm trying to improve it at least a bit. The first thing I wanted > to do was to cache the jQuery objects. In this case I created global > variables for this. > > Besides the global variables, I have a couple of functions using > "live" to bind a handler to an mousedown or click event. > > Now, when trying to use the variables in those functions I recognized > two "effects": > > 1. > Trying to apply .attr('disabled': true) to one of the cached objects > doesn't work, while applying other attributes seems to work fine. > > 2. > When defining a new variable in one of the functions, and trying to > use one of the global ones in it, it also doesn't seem to work > (something like this: var seriesAjaxOptions = $seriesAjax.html(); - > $seriesAjax being a cached object). > > Any idea what's going on (or what could be going on) here? > > Thanks!
[jQuery] Re: jquery.ajax executes error function for Web Server HTTP 201 Response
201 is considered as a success. It could be an error somewhere else, try to step through httpSuccess function. // Determines if an XMLHttpRequest was successful or not httpSuccess: function( xhr ) { try { // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 return !xhr.status && location.protocol == "file:" || ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223; } catch(e){} return false; } On Jul 21, 2:42 pm, Nitin wrote: > Hello, > > I am using jquery.ajax() to make a POST call to web server which > returns HTTP 201 response for successful creation of object at server. > Since 201 is a success I expect the success function specified with > jquery.ajax to execute but instead it executes the error function > specified with jquery.ajax. Here is how I am using jquery.ajax call. > > request = 'SomeName'; > $.ajax({ > error:function(request) { > alert('Error creating user'); > }, > success:function(xml, textStatus) { > alert('success'); > }, > type: 'POST', > contentType: 'application/xml;charset=UTF-8', > url: server_root + '/management/users/', > data: request > > }); > > Does success function gets executed only for HTTP 200 Response or will > it be executed for HTTP 201 Response too? > > In case success function gets executed only for 200 response, how can > I handle 201 response which is a success response? > > Any help to resolve above issue is appreciated. > > Thanks, > Regards, > Nitin
[jQuery] Re: Validation plugin - submit form without validation
Try $("#frm")[0].submit() On Jul 20, 1:56 pm, Adam P wrote: > I'm using the Validation plugin for JQuery and was wondering if there > was a function to submit the form without causing it to validate the > form. I have a table with a list of radio-buttons and above that is a > drop down list of states. The drop down list of states is used to > filter the table rows and when the selected item changes it posts-back > to the server (via $("#frm").submit()). I don't want this to cause > any validation to occur. Is there another function I can call besides > submit(), or some other method? > > Thanks
[jQuery] Re: Noob question about wrapped sets
$("#myElement) returns jQuery object and $("#myElement")[0] returns DHTML object. Here is a sample on how to access alt attribute jQuery $("#myElement").attr("alt") vs DHTML $("#myElement")[0].alt Both code return the same value. Correct me if i am wrong, I think the DHTML version is faster than the jQuery one. On Jul 21, 8:07 am, nyte999 wrote: > Going through the tutorials on this website and others, I've found > some syntax that I don't understand and is never explained. Usually > wrapped sets look like this: > > $(#myElement) > > But once in a while they look like this > > $(#myElement)[0] > > Here are a few examples of it in use: > > $("div").index($("div#myDiv")[0]); > $("#myImage")[0].alt; > > I don't get it. The sample code is NEVER trying to find the first > element of an array. From my POV this format seems completely random > and unnecessary, yet the jQuery code will NOT work if the "[0]" is > removed. I know it's something glaringly obvious and I'll feel stupid > when I get the answer, but my god, I just can't figure out the pattern > here. Please help.
[jQuery] Re: Value adding to drop down
OK that means the values causing the problem. Are your strings stored in the database as double byte characters? Try to view your page in Firefox and use firebug to display the value instead of using alert (). On Jul 20, 2:08 pm, naz wrote: > i have values in data like BSIT|MSIT|BSC| etc when i used alert(). to > display data values then values are correct but when values appear in > drop down they become |BSIT > code is like this > var programs=[]; > alert(data); > programs=data.split('|'); > $('#p_course').length = 1; > for(var i=0;i { > var objDropdown =$('#p_course').get(0); > var objOption = new Option(programs[i],programs[i]);// > adding option > objDropdown.options[objDropdown.length] = objOption; > } > > actually i m storing these values in data from db may be thats why > there is a problem bcs when i use static value then it appear > correctly. If u can understand whts gng on plz tell me thnx alot > On Jul 18, 12:55 pm, Theodore Ni wrote: > > > Please post again your current jQuery code including the separator you are > > using, as well as what is inside the data variable in full. That way, we can > > understand exactly what's going on; right now, I'm still confused. > > Teddy > > > On Sat, Jul 18, 2009 at 12:07 AM, naz wrote: > > > > i have changed '|' seperator still it is not working.:( > > > > On Jul 16, 10:31 am, 刘永杰 wrote: > > > > change split character,not use '|'. > > > > > 2009/7/16 naz > > > > > > hi > > > > > i m adding some values to drop down > > > > > by usind j query by this code > > > > > var programs=[]; > > > > > programs=data.split('|'); > > > > > $('#p_course').length = 1; > > > > > for(var i=0;i > > > > { > > > > > var objDropdown =$('#p_course').get(0); > > > > > var objOption = new Option(programs[i],programs[i]); > > > > > objDropdown.options[objDropdown.length] = objOption; > > > > > } > > > > > but when vales appear in drop down first value look like this > > > > > |BSIT > > > > > any body have any idea why it look like this- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text -
[jQuery] Re: Value adding to drop down
I tested your code with the following data var data = 'program1|program2|program3|'; and the drop down combo box displays program1 program2 program3 correctly. Again could you post the value of your data? On Jul 18, 2:07 pm, naz wrote: > i m using internet explorar.and data value is SE,DLD etc i m getting > these values from db. > > On Jul 16, 11:14 am, Jules wrote: > > > The code looks fine to me. Could you post the data value? What is > > the browser you are using? > > > On Jul 16, 2:58 pm, naz wrote: > > > > hi > > > i m adding some values to drop down > > > by usind j query by this code > > > var programs=[]; > > > programs=data.split('|'); > > > $('#p_course').length = 1; > > > for(var i=0;i > > { > > > var objDropdown =$('#p_course').get(0); > > > var objOption = new Option(programs[i],programs[i]); > > > objDropdown.options[objDropdown.length] = objOption; > > > } > > > but when vales appear in drop down first value look like this > > > |BSIT > > > any body have any idea why it look like this- Hide quoted text - > > > - Show quoted text -
[jQuery] Re: Can this plugin be structured better?
In the object init, pass this. switch (tag) { case 'DIV': obj = new $.myDiv(); obj.init ($this);break; jQuery.myDiv= function() { this.init = initDiv; this.doSomething = divFunction; this.actualObject; return this; function initDiv(obj) { this.acutalObject = obj; } function divFunction() { // call shared function $.sharedDoSomething(); } } jQuery.sharedDoSomething = function() { } Hope that make sense. On Jul 16, 4:38 pm, Harvey wrote: > I did think of that solution but where would I put functions shared by > myImg and myDiv that need access to the $this and tag variables?
[jQuery] Re: Can this plugin be structured better?
May be something like this? (function($) { $.fn.editable = function(options) { var defaults = { // default value declarations } var opts = $.extend(defaults, options); return this.each(function() { var $this = $(this); // Cache a jQuery version of this var tag = $this.get(0).tagName; var obj; this.doSomething = obj.doSomething; switch (tag) { case 'DIV': obj = new $.myDiv(); obj.init(); break; case 'IMG': obj = new $.myImg(); obj.init(); break; } }); } })(jQuery); jQuery.myImg = function() { { this.init = initImg; this.doSomething = imgFunction; return this; function initImg() { } function imgFunction() { } } jQuery.myDiv= function() { this.init = initDiv; this.doSomething = divFunction; return this; function initDiv() { } function divFunction() { } } On Jul 12, 6:37 pm, Harvey wrote: > Hey, > > I'm in the process of developing a new plugin but the way I have > structured the codes doesn't seem quite right to me so I'm hoping > someone might be able to offer a better way to do it. > > The plugin itself has different behaviour if called on different types > of elements (images, divs etc) with a range of shared functions used > across all element types. > > This is the basic structure I have so far: > > (function ($) { > $.fn.editable = function (options) { > var defaults = { > // default value declarations > } > > var opts = $.extend(defaults, options); > > return this.each(function () { > var $this = $(this); // Cache a jQuery version of this > var tag = $this.get(0).tagName; > > switch(tag) { > case 'DIV': initDiv(); break; > case 'IMG': initImage(); break; > } > > function initDiv () { > // initialise the plugin to work with divs > } > > function initImage () { > // initialise the plugin to work with images > } > > // functions used by divs only > function divFunction () { > // body... > } > > // functions used by images only > function imageFunction () { > // body... > } > > // functions used by divs and images > function sharedFunction () { > // body... > } > > }); > } > > })(jQuery); > > The reason it does seem right to me is because any instance of the > plugin called on a div will also contain all the code that is used if > it was an image even though the code won't be used. > > Can any offer something better?
[jQuery] Re: Value adding to drop down
The code looks fine to me. Could you post the data value? What is the browser you are using? On Jul 16, 2:58 pm, naz wrote: > hi > i m adding some values to drop down > by usind j query by this code > var programs=[]; > programs=data.split('|'); > $('#p_course').length = 1; > for(var i=0;i { > var objDropdown =$('#p_course').get(0); > var objOption = new Option(programs[i],programs[i]); > objDropdown.options[objDropdown.length] = objOption; > } > but when vales appear in drop down first value look like this > |BSIT > any body have any idea why it look like this
[jQuery] Re: (validate) Validating multiple drop down boxes
I had simillar problem to this. The solution is a little bit clumsy but it works. --SCRIPT $(document).ready(function() { $("#inputForm").validate({ errorLabelContainer: "#errorContainer", wrapper: "li" }); $("#MOB").change(function() { if ($(this).val() == "") $("#hidDOB").val($("#hidDOB").val() & 5); else $("#hidDOB").val($("#hidDOB").val() | 2); }); $("#DOB").change(function() { if ($(this).val() == "") $("#hidDOB").val($("#hidDOB").val() & 6); else $("#hidDOB").val($("#hidDOB").val() | 1); }); $("#YOB").change(function() { if ($(this).val() == "") $("#hidDOB").val($("#hidDOB").val() & 3); else $("#hidDOB").val($("#hidDOB").val() | 4); }); $("#hidDOB").rules("add", { min: 7, messages: { min:"Incomplete birthdate." } }); --HTML Date of Birth Month January Day 02 Year 1906 etc. etc. On Jul 16, 8:06 am, mgs wrote: > Hi All, > > I need to check that a user's birthday has been filled out completely, > using drop down menus. I can validate each of the menus individually > (see code below), but what i really want to do is make one check that > all three are selected so that I don't have 3 extra error labels... > Any suggestions? > > $(document).ready(function(){ > $("#form1").validate({ > rules: { > MOB: "required" , > DOB: "required", > YOB: "required" > }, > messages: { > MOB: "Need a month", > DOB: "Need a Day", > YOB: "Need a year", > } > )}; > )}; > > > Date of > Birth > > selected="selected">Month > value="2">January > > > selected="selected">Day > 02 > > > selected="selected">Year > value="1906">1906 > etc. > etc. > >
[jQuery] Re: manipulate the next element with a class
Opps, after re-reading the original post it should be $(this).parent().next().find(".a1").css({ "visibility": "hidden" }); However, this only works for #container1 .link1 and #container2 .link1. If you click #container3 .link1, nothing happens. On Jul 16, 10:24 am, Jules wrote: > It should be siblings() not find(). > > On Jul 16, 8:00 am, Benn wrote: > > > Is there a non-structure specific way of finding the next element with > > a given class? for example you have a structure of: > > > > > link > > asdf > > > > > > > link > > ghjl > > > > > > > link > > qwer > > > > > When you click on the link in container1 the expected behavior is to > > change the css on a1 in container2 but not in container1 or > > container3. I have tried playing with parent, next and filter without > > success. this is the best I have is: > > > $(document).ready(function(){ > > $(".link1").click(function(){ > > $(".a1").css({"visibility":"hidden"}); //hides all a1's but keeps > > the space > > }); > > > });
[jQuery] Re: manipulate the next element with a class
It should be siblings() not find(). On Jul 16, 8:00 am, Benn wrote: > Is there a non-structure specific way of finding the next element with > a given class? for example you have a structure of: > > > link > asdf > > > > link > ghjl > > > > link > qwer > > > When you click on the link in container1 the expected behavior is to > change the css on a1 in container2 but not in container1 or > container3. I have tried playing with parent, next and filter without > success. this is the best I have is: > > $(document).ready(function(){ > $(".link1").click(function(){ > $(".a1").css({"visibility":"hidden"}); //hides all a1's but keeps > the space > }); > > });
[jQuery] Re: Inserting elements
If you want to be sure the is appended after the last li use this $(".list li:last").after("item " + (parseInt($(".list li").length,10) + 1) + ""); On Jul 15, 10:24 am, Eno wrote: > Given this HTML: > > item 1 > > How would I insert elements inside the element after the > existing ? I tried using append() but that created a second > element with the new elements inside it after the existing block. > > --
[jQuery] Re: Validate textbox (required=true) on combobox selected value
Its in the validate documentation http://docs.jquery.com/Plugins/Validation/Methods/required#dependency-expression In your case rules: { newColor: { required: function(element) { return $("#color").val() == -1; } } On Jun 24, 10:52 pm, ciupaz wrote: > Hi all, > I have to validate a textbox if the user select a particular value in > a combobox. > For example, if the user select the "Specify new color" in the > following combobox: > > > Specify new color > Red > Green > Blue > White > Black > > > I have to validate the following textbox: > > > > with the Validate Plugin: > > rules: { > newColor: { > required: ?? > }, > > How can I accomplish this? > > Thanks in advance. > > Luis.
[jQuery] [validate] Validating a formatted number failed
Hi all, I am using validate (1.5.4) plugin to validate numeric input field with max:5000.00. When the numeric value is formatted as "2,999.00", the max validation failed. After some investigation, it turns out the max function compare the value "2,999.00" as string with 5000.00 instead of 2999.00 with 5000.00. To fix this, I modified the existing value variable with parseFloat(value.replace(",","") in min:, max:, and range:. Note: Only works in countries that use "," as thousand separator. For Jörn, could this fix be included on your future release? Thanks.
[jQuery] Triggering asp:Button click event from client side
Hi, I have a page with an asp:Button save that performs an ajax validation before post back. If the data is incorrect, the aspx returns a warning text message. The user can ignore the warning and continue to save the data. I managed to perform the desired result using the posted code below. Notice that the button click event is called 2 times first when the user trigger the event, then the 2nd time by target.click() after setting the doCheck and response values. I am not happy with the code. Is there any other way to replace target.click() with some thing which by pass the validation again? var doCheck = true; var response = true; $(document).ready(function() { $("input[name$='ajaxConfirm']").bind("click", function(e) { var target = $(e.target); if (doCheck) { $.get("GetConfirmation.aspx", { param1: "test", param2: "data" }, function(result) { if (result != "") { response = confirm(result); } doCheck = false; target.click(); //replace this } , "text"); e.preventDefault(); } else { if (!response) e.preventDefault(); doCheck = true; response = true; } }); -- Generated asp:Button