[jQuery] How to insert HTML in an iframe
Hi, I need to insert HTML in an iframe. This works in IE but not in Firefox: $(this.iframe).append("hello"); What is the problem in Firefox? Thank you very much.
[jQuery] [Form Plugin] - Bug in version 2.28 at line 61 (lack semicolon)
Hi. Today I was trying compress the jQuery Form Plugin V 2.28 (http:// malsup.com/jquery/form/) with JavaScriptPacker (http:// dean.edwards.name/packer/) but I get an error in Firefox 3.5: "missing ; before statement". I revised the code and I can see that lack the semicolon at end of line 61: url = url || window.location.href || '' I corrected this and can compress the js correctly. Best Regards, Pablo Santa Fe - Argentina http://www.infosoft.com.ar
[jQuery] [treeview] Collapsed tree will flash before collapsing. Anyway to avoid it?
Hi Guys, I'm using the treeview jQuery plugin (http://bassistance.de/jquery- plugins/jquery-plugin-treeview/) to display the sitemap for a site. My customer wants to see the tree collapsed on the page load and the user should expand it as he sees fit. So, I've setup it like that: jQuery(function($) { $(".sitePlan>ul").treeview({ collapsed: true, unique: true, control: true, persist: location }); }); The problem is that in IE (6, 7 and 8) the user will see first the treeview completely expanded and then it will collapse at the end of the page load. Is there a way to avoid that, thus showing only the collapsed tree from the start? Or to make it invisible until the moment it is collapsed?
[jQuery] problem with href attribute after loading content with load (IE)
Hi all, I am having serious problems for getting the value of the href attribute as it appears in the source, in IE. I load some content with the load function and this content has links, that are relative to the document of origin, after being loaded, the href attribute is changed into a wrong absolute value. The getAttribute("href", 2) still returns the absolute value, I think this is because IE changes the value after being loaded. Example: http://any.com/bla1/bla2/bla3/origin.html $(div#loader).load("another.html #something") http://any.com/bla1/bla2/another.html ... (Points correctly to http://any.com/bla1/destiny.html) And after loading the content, I only am able to get, in IE, the value http://any.com/bla1/bla2/destiny.html Any suggestion?? Thanks in advance
[jQuery] Re: Pro Javascript Techniques Doubt
Yeah it sounds complicated... I'm kinda newbe to this, I hope you don't mind if I ask these silly questions I thought the anonymous function got executed on this line for ( var i in properties ) { (function(){ this[ "get" + i ] = function() { return properties[i]; }; this[ "set" + i ] = function(val) { properties[i] = val; }; }).call(this)--> EXECUTE! (and use actual value of i) // now go on with the next i ; } Isn't this the "logical" way of seeing it? what am I missing? On Thu, Dec 18, 2008 at 3:38 PM, Balazs Endresz wrote: > > this[ "set" + i ] = function(val) { >properties[i] = val; > }; > > This code only defines a function but doesn't execute its contents > right now, and as functions "capture" the variables defined outside of > them if you change the value of i then it will "change" in properties > [i] too. In other words the `i` in properties[i] is the same that you > use for the loop. > > If you use a closure you can define a local variable that gets the > value (not the reference!) of the current index so that won't change > afterwards. > > Sounds complicated but it really isn't - once you get it :) > > On Dec 18, 5:52 pm, "pablo fernandez" > wrote: >> That Does it too!! >> >> I still don't get why 'i' keeps always the last value if you don't do >> var i = j; :S >> >> On Thu, Dec 18, 2008 at 1:11 PM, Balazs Endresz >> >> >> >> wrote: >> >> > I've just had a look at it and where this issue comes up in the book >> > there's a new variable declared (like on page 153). No need to pass >> > the argument this way, moreover not that easy to mistype: >> >> > for ( var j in properties ) { (function(){ >> >var i=j; >> >... >> >> > I can't believe no one has spotted >> > this:http://www.apress.com/book/errata/275 >> >> > On Dec 18, 4:53 pm, Pablo Fernandez >> > wrote: >> >> That did it, although I had to add this too >> >> >> -- }).call(this,i); >> >> >> in order to pass the parameter >> >> >> Thanks Balazs!!! >> >> >> On 18 dic, 12:29, Balazs Endresz wrote: >> >> >> > Oops, I didn't notice it: you have to pass the `i` variable too: >> >> > for ( var i in properties ) { (function(i){ >> >> >> > That's why you need the closure at all. Without that you will get the >> >> > last property from all getters. >> >> >> > The reference of `this` will always change if you put it in an >> >> > additional function, doesn't matter if it's inside an instantiated >> >> > object. Well, you can call that either design error or feature too :) >> >> >> > On Dec 18, 4:18 pm, Pablo Fernandez >> >> > wrote: >> >> >> > > another thing... why inside the anonymous function 'this' refers to >> >> > > 'window' ?? it's totally misleading... >> >> -- >> Fernandez, Pablo. > > > -- Fernandez, Pablo.
[jQuery] Re: Pro Javascript Techniques Doubt
That Does it too!! I still don't get why 'i' keeps always the last value if you don't do var i = j; :S On Thu, Dec 18, 2008 at 1:11 PM, Balazs Endresz wrote: > > I've just had a look at it and where this issue comes up in the book > there's a new variable declared (like on page 153). No need to pass > the argument this way, moreover not that easy to mistype: > > for ( var j in properties ) { (function(){ >var i=j; >... > > I can't believe no one has spotted this: http://www.apress.com/book/errata/275 > > On Dec 18, 4:53 pm, Pablo Fernandez > wrote: >> That did it, although I had to add this too >> >> -- }).call(this,i); >> >> in order to pass the parameter >> >> Thanks Balazs!!! >> >> On 18 dic, 12:29, Balazs Endresz wrote: >> >> > Oops, I didn't notice it: you have to pass the `i` variable too: >> > for ( var i in properties ) { (function(i){ >> >> > That's why you need the closure at all. Without that you will get the >> > last property from all getters. >> >> > The reference of `this` will always change if you put it in an >> > additional function, doesn't matter if it's inside an instantiated >> > object. Well, you can call that either design error or feature too :) >> >> > On Dec 18, 4:18 pm, Pablo Fernandez >> > wrote: >> >> > > another thing... why inside the anonymous function 'this' refers to >> > > 'window' ?? it's totally misleading... > > > -- Fernandez, Pablo.
[jQuery] Re: Pro Javascript Techniques Doubt
That did it, although I had to add this too -- }).call(this,i); in order to pass the parameter Thanks Balazs!!! On 18 dic, 12:29, Balazs Endresz wrote: > Oops, I didn't notice it: you have to pass the `i` variable too: > for ( var i in properties ) { (function(i){ > > That's why you need the closure at all. Without that you will get the > last property from all getters. > > The reference of `this` will always change if you put it in an > additional function, doesn't matter if it's inside an instantiated > object. Well, you can call that either design error or feature too :) > > On Dec 18, 4:18 pm, Pablo Fernandez > wrote: > > > another thing... why inside the anonymous function 'this' refers to > > 'window' ?? it's totally misleading...
[jQuery] Re: Pro Javascript Techniques Doubt
another thing... why inside the anonymous function 'this' refers to 'window' ?? it's totally misleading...
[jQuery] Re: Pro Javascript Techniques Doubt
thanks that seems to work, but the 'getname' method returns 44 instead of "Bob", and then 22... it appears that it's pointing to the age variable, any idea why? thank you!
[jQuery] Pro Javascript Techniques Doubt
Hi, I'm reading "Pro Javascript Techniques" from John Resig, and I'm confused with an example. This is the code: // Create a new user object that accepts an object of properties function User( properties ) { // Iterate through the properties of the object, and make sure // that it's properly scoped (as discussed previously) for ( var i in properties ) { (function(){ // Create a new getter for the property this[ "get" + i ] = function() { return properties[i]; }; // Create a new setter for the property this[ "set" + i ] = function(val) { properties[i] = val; }; })(); } } // Create a new user object instance and pass in an object of // properties to seed it with var user = new User({ name: "Bob", age: 44 }); // Just note that the name property does not exist, as it's private // within the properties object alert( user.name == null ); // However, we're able to access its value using the new getname() // method, that was dynamically generated alert( user.getname() == "Bob" ); // Finally, we can see that it's possible to set and get the age using // the newly generated functions user.setage( 22 ); alert( user.getage() == 22 ); Now running that on Firebug console (on FF3) throws that user.getname () is not a function. I tried doing this: var other = User other() window.getname() --> this works! And it worked! Any idea why? thanks everybody! PS: I know this is not an specific Jquery thing but a Javascript question, but I didn't know where to ask.
[jQuery] Re: Add span and class with text used inside a href - WrapInner according to text
I was trying to use InnerWrap but firebug say is not a function. > Hi group, > > How do i dinamically convert strings like > view > view > view > view > To: > view > add > edit > delete > > I was reading: > http://docs.jquery.com/Attributes/text > http://docs.jquery.com/Manipulation/wrapInner > > Thanks ind advance. > >
[jQuery] Re: Using jQuery Form Plugin - submitting special characters
hubbs, Smart quotes from MS Word are a different charset (windows-1252). To have them correctly displayed you'll need to set your page to this charset and also check that your server accepts it (Firebug can tell you that). However, I'm dealing with a similiar problem... I'm using ISO-8859-1 both in mi pages and my server. Special characters ("á", "ñ") are display correctly but when I try to send them through $.ajax they are displayed as strange symbols as if the charset is UTF-8. I'm clueless if anyone has any idea, please let me know. Thanks, Pablo On 11 jul, 15:11, hubbs <[EMAIL PROTECTED]> wrote: > I am trying to send special characters through my form, using the form > plugin, but they keep on getting converted to strange characters. > e.g. Smart quotes from MS Word, etc. > > So, what I am wondering is, what do I need to do to fix this? I > thought that submitting the form into an iframe with the form plugin > would fix this problem, but it doesn't seem to, still the same issue. > > Do I need to tell the form plugin to use the same charset that I use > on my site? > >
[jQuery] Re: jQuery version
I respond myself: jQuery.jquery or maybe $.jquery (I only test the first form). Byes, Gorlok 2008/6/17 gorlok <[EMAIL PROTECTED]>: > > Hi, > I'm looking for jQuery().version() or something similar. I want to > verify what version of jQuery is installed. > > Thanks in advance! > > PD: I'm using jQuery as included in JBoss Richfaces / SEAM. >
[jQuery] Events priority
Hey guys, I'm rather new at this but I've got a problem with setting priorities to events that has kept me up all night. The issue is quite simple: - An image is clicked - A floating box appears with the image preview and a "Change Image" button - If you click the "Change Image" button, it'll toggle a carousel with more images (inside the box) - If the whole box looses focus, it'll be removed. Now, I couldn't get the box to have focus when it appears, so, I bind the focus event to the "Change Image" button. But, now, of course, when you click that button, the carousel gets focused and the blur event is trigger, removing the whole box. I was looking for a way to set event priorities, so as to have the carousel event trigger first and later the blur. But I think that's browser dependent, right? Here's the code: $("a.preview").each( function(i) { $(this).click(function(e){ e.preventDefault(); newTag = ""; newTag += ""; newTag += "Change Image"; newTag += ""; newTag += ""; newTag += ""; $(this).parent().append(newTag); $("#preview div.fotos").hide(); $("#preview") .css("top",(e.pageY - xOffset) + "px") .css("left",(e.pageX + yOffset) + "px") .fadeIn("fast"); $(".news_foto p a.button").each( function(i) { $(this).focus() .toggle( function(e) { //$(this).parents("#preview").remove(); $("#preview div.fotos").show("slow"); }, function(e) { $("#preview div.fotos").hide("slow"); } ) .blur( function(e){ $(this).parents("#preview").remove(); }); }); }); }); }; Any help or workaround will be greatly appreciated. Thanks Poly
[jQuery] Re: [validate] spinner - loading
Thank you Jörn . // set this class to error-labels to indicate valid fields $("#UserRegisterForm").bind("ajaxSend", function(){ alert("Send!"); }).bind("ajaxComplete", function(){ alert("Complete!"); }); Now im going to use some div to show or hide. I love your plugin, is a piece of art.
[jQuery] Re: submit problem [validation]
Yes, im using Jquery validation, but im still trying to translate this old onClick button to call plugin validate? How can i do that using the same button? I need to use the same button cause this button is part of a toolbar. http://bassistance.de/jquery-plugins/jquery-plugin-validation/ $().ready(function() { // add * to required field labels $("div.required label").append(" * "); jQuery.validator.addMethod("specialAlphaNumeric", function( value, element ) { var result = this.optional(element) || value.length >= 2 && /^([A-Z0-9áéíóúüçìñ.,'_\- ]+)$/i.test(value); if (!result) { //element.value = ""; var validator = this; setTimeout(function() { validator.blockFocusCleanup = true; element.focus(); validator.blockFocusCleanup = false; }, 1); } return result; }, "Puede contener espacios, tener al menos dos y cualquiera de los siguientes carácteres: [a-z][0-9][áéíóúüçìñ.,'_-]"); jQuery.validator.addMethod("alphaNumeric", function( value, element ) { var result = this.optional(element) || value.length >= 2 && /^[A-Z]([A-Z0-9]+)$/i.test(value); if (!result) { //element.value = ""; var validator = this; setTimeout(function() { validator.blockFocusCleanup = true; element.focus(); validator.blockFocusCleanup = false; }, 1); } return result; }, "Debe empezar con una letra, tener al menos dos y cualquiera de los siguientes carácteres: [a-z][0-9]"); $("#UserRegisterForm").validate({ // the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { if ( element.is(":radio") ) error.appendTo( element.parent().next().next() ); else if ( element.is(":checkbox") ) error.appendTo ( element.next() ); else error.appendTo( element.parent().next() ); }, // specifying a submitHandler prevents the default submit, good for the demo submitHandler: function() { alert("submitted!"); }, // set this class to error-labels to indicate valid fields success: function(label) { // set as text for IE label.html(" ").addClass("checked"); } }); });
[jQuery] wish: WYSIWYG Form Editor
Hi jQuery gurus: I would like to see a WYSIWYG Form Editor like this one: http://www.themaninblue.com/experiment/widgEditor/ but in jQuery of course. Or already exists one?. ? Cheers -- juan pablo aqueveque www.juque.cl