[jQuery] Re: "Object doesn't support this property or method" in IE
Hmm. No idea why it doesn't work in IE, but here are some general observations: You don't need the "jQuery(function(){" part around the function. setTimeout(updateStatus, 2); // use the function object $(document).ready(updateStatus); //same here, pass the object, don't call the function. this can also go in the script along with the rest See how that works out, here's the code: http://snipt.org/mogk And you could use some logic to make it less spaguetti too: http://snipt.org/mogl On Sep 15, 3:08 pm, knox203 wrote: > Hello everyone, I have the following code that works great in Firefox, > Opera, Safari, but fails to work in IE. Can anyone take a look and > maybe tell me what I'm doing wrong? Thanks! > > > > > function updateStatus(){ > jQuery(function(){ > $("#prov1hCount").load("source/provStats.php #prov1hCount"); > $("#prov1hOntime").load("source/provStats.php > #prov1hOntime"); > $("#prov1hLate").load("source/provStats.php > #prov1hLate"); > $("#prov1hPuAverage").load("source/provStats.php > #prov1hPuAverage"); > $("#prov1hMTDPuAverage").load("source/provStats.php > #prov1hMTDPuAverage"); > $("#prov2hCount").load("source/provStats.php > #prov2hCount"); > $("#prov2hOntime").load("source/provStats.php > #prov2hOntime"); > $("#prov2hLate").load("source/provStats.php > #prov2hLate"); > $("#prov2hPuAverage").load("source/provStats.php > #prov2hPuAverage"); > $("#prov2hDelAverage").load("source/provStats.php > #prov2hDelAverage"); > $("#prov2hMTDPuAverage").load("source/provStats.php > #prov2hMTDPuAverage"); > }); > setTimeout("updateStatus()",2); > } > > > > ... > > > $(document).ready(updateStatus()); >
[jQuery] Re: Superfish menu problem.
Drop-down menu is working, but it will no display due to overflow:hidden in "clear". You have to make some changes. Add height & width in tail-top-menu and remove "clear" class from that div. .tail-top-menu { height:30px; width:100% } and also add height in ".sf-menu a" && "sf-menu li" class according to requirement ... I think this will resolve your problem. Thanks Rupak On Wed, Sep 16, 2009 at 11:04 AM, sholland wrote: > > Here aree the CSS styles being applied to that menu position by the > template and by the superfish css. > > Thanks > Suzanna > > ***TEMPLATE > CSS* > > .tail-top-menu{ background:#f0f0f1 url(../images/top_menu_tail.gif) > bottom left repeat-x;} > > > ** > body, td, th, div, p, label{ >color:#838383; >font:normal 12px/16px Arial, Helvetica, sans-serif; > } > > a { >color:#5D5D60; >text-decoration:underline; > } > > a:hover { >color:#5D5D60 ; >text-decoration:none > } > select{color:#878B8E; font-size:11px;} > > > *** > .clear{ width:100%; overflow:hidden;} > > > *** > * { >padding:0px 0px 0px 0px; >margin:0px 0px 0px 0px; > } > > * > ul > > { > > list-style-type: disc; > > list-style-image: none; > > list-style-position: outside; > > margin-top: 0px; > > margin-right: 0px; > > margin-bottom: 0px; > > margin-left: 15px; > > } > > .menu > > { > > margin-top: 14px; > > margin-right: 0pt; > > margin-bottom: 0px; > > margin-left: 31px; > > list-style-type: none; > > list-style-image: none; > > list-style-position: outside; > > padding-top: 1px; > > } > > END TEMPLATE > CSS > > **SUPERFISH > CSS > .sf-menu, .sf-menu * > > { > > margin-top: 0pt; > > margin-right: 0pt; > > margin-bottom: 0pt; > > margin-left: 0pt; > > padding-top: 0pt; > > padding-right: 0pt; > > padding-bottom: 0pt; > > padding-left: 0pt; > > list-style-type: none; > > list-style-image: none; > > list-style-position: outside; > > } > > .sf-menu > > { > > line-height: 1; > > } > > .sf-menu > > { > > float: left; > > margin-bottom: 1em; > > } > > > a > > { > > color: #5d5d60; > > text-decoration: underline; > > } > > a:hover > > { > > color: #5d5d60; > > text-decoration: none; > > } > > .menu li a > > { > > color: #91caff; > > font-size: 13px; > > text-decoration: none; > > padding-top: 0pt; > > padding-right: 0pt; > > padding-bottom: 0pt; > > padding-left: 27px; > > } > > .menu li a:hover > > { > > color: #ff; > > text-decoration: underline; > > } > > .sf-menu, .sf-menu * > > { > > margin-top: 0pt; > > margin-right: 0pt; > > margin-bottom: 0pt; > > margin-left: 0pt; > > padding-top: 0pt; > > padding-right: 0pt; > > padding-bottom: 0pt; > > padding-left: 0pt; > > list-style-type: none; > > list-style-image: none; > > list-style-position: outside; > > } > > .sf-menu a > > { > > display: block; > > position: relative; > > } > > .sf-menu a > > { > > border-left-width-value: 1px; > > border-left-style-value: solid; > > border-left-color-value: #ff; > > border-left-width-ltr-source: physical; > > border-left-width-rtl-source: physical; > > border-left-style-ltr-source: physical; > > border-left-style-rtl-source: physical; > > border-left-color-ltr-source: physical; > > border-left-color-rtl-source: physical; > > border-top-width: 1px; > > border-top-style: solid; > > border-top-color: #cfdeff; > > padding-top: 0.75em; > > padding-right: 1em; > > padding-bottom: 0.75em; > > padding-left: 1em; > > text-decoration: none; > > } > > .sf-menu a, .sf-menu a:visited > > { > > color: #1133aa; > > } > > .sf-menu a, .sf-menu a:visited > > { > > color: #1133aa; > > } > > .sf-menu li:hover, .sf-menu li.sfHover, .sf-menu a:focus, .sf-menu > a:hover, .sf-menu a:active > > { > > background-color: #cfdeff; > > background-image: none; > > background-repeat: repeat; > > background-attachment: scroll; > > background-position: 0% 0%; > > outline-color: -moz-use-text-color; > > outline-style: none; > > outline-width: 0pt; > > } > > .sf-menu li:hover, .sf-menu li.sfHover, .sf-menu a:focus, .sf-menu > a:hover, .sf-menu a:active > > { > > background-color: #cfdeff; > > background-image: none; > > background-repeat: repeat; > > background-attachment: scroll; > > background-position: 0% 0%; > > outline-color: -moz-use-text-color; > > outline-style: none; > > outline-width: 0pt; > > } > END SUPERFISH > CSS >
[jQuery] keeping table header fix
Hello guys, I'd like to know if there is a way to keep a table header fixed on top of a div while I scroll the table rows. I have a div high 200px and the table itself is around 300px so when I scroll down I'd like to always see the header on top. I already use for the table tablesorter so the solution must be compatible with that plug-in. Thanks and have a nice day! Sig
[jQuery] Re: Superfish menu problem.
Here aree the CSS styles being applied to that menu position by the template and by the superfish css. Thanks Suzanna ***TEMPLATE CSS* .tail-top-menu{ background:#f0f0f1 url(../images/top_menu_tail.gif) bottom left repeat-x;} ** body, td, th, div, p, label{ color:#838383; font:normal 12px/16px Arial, Helvetica, sans-serif; } a { color:#5D5D60; text-decoration:underline; } a:hover { color:#5D5D60 ; text-decoration:none } select{color:#878B8E; font-size:11px;} *** .clear{ width:100%; overflow:hidden;} *** * { padding:0px 0px 0px 0px; margin:0px 0px 0px 0px; } * ul { list-style-type: disc; list-style-image: none; list-style-position: outside; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 15px; } .menu { margin-top: 14px; margin-right: 0pt; margin-bottom: 0px; margin-left: 31px; list-style-type: none; list-style-image: none; list-style-position: outside; padding-top: 1px; } END TEMPLATE CSS **SUPERFISH CSS .sf-menu, .sf-menu * { margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0pt; padding-top: 0pt; padding-right: 0pt; padding-bottom: 0pt; padding-left: 0pt; list-style-type: none; list-style-image: none; list-style-position: outside; } .sf-menu { line-height: 1; } .sf-menu { float: left; margin-bottom: 1em; } a { color: #5d5d60; text-decoration: underline; } a:hover { color: #5d5d60; text-decoration: none; } .menu li a { color: #91caff; font-size: 13px; text-decoration: none; padding-top: 0pt; padding-right: 0pt; padding-bottom: 0pt; padding-left: 27px; } .menu li a:hover { color: #ff; text-decoration: underline; } .sf-menu, .sf-menu * { margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0pt; padding-top: 0pt; padding-right: 0pt; padding-bottom: 0pt; padding-left: 0pt; list-style-type: none; list-style-image: none; list-style-position: outside; } .sf-menu a { display: block; position: relative; } .sf-menu a { border-left-width-value: 1px; border-left-style-value: solid; border-left-color-value: #ff; border-left-width-ltr-source: physical; border-left-width-rtl-source: physical; border-left-style-ltr-source: physical; border-left-style-rtl-source: physical; border-left-color-ltr-source: physical; border-left-color-rtl-source: physical; border-top-width: 1px; border-top-style: solid; border-top-color: #cfdeff; padding-top: 0.75em; padding-right: 1em; padding-bottom: 0.75em; padding-left: 1em; text-decoration: none; } .sf-menu a, .sf-menu a:visited { color: #1133aa; } .sf-menu a, .sf-menu a:visited { color: #1133aa; } .sf-menu li:hover, .sf-menu li.sfHover, .sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active { background-color: #cfdeff; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; outline-color: -moz-use-text-color; outline-style: none; outline-width: 0pt; } .sf-menu li:hover, .sf-menu li.sfHover, .sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active { background-color: #cfdeff; background-image: none; background-repeat: repeat; background-attachment: scroll; background-position: 0% 0%; outline-color: -moz-use-text-color; outline-style: none; outline-width: 0pt; } END SUPERFISH CSS
[jQuery] Re: Get the onclick method of an element
On Sep 15, 6:09 pm, sirrocco wrote: > Let's say you have a : > > asd > > I want to get the onclick text in a variable - something like > > var onclick = $('a').attr('onclick'); > > The problem is that the onclick variable now is a function and if I > try to execute , this wil be the document instead of the link . That is (in part) because the attr method returns a reference to the function object, i.e. it returns the DOM property, not the HTML attribute. > How can I get only the text, You could try the getAttribute method, but it's buggy in IE: var listenerCode = element.getAttribute('onclick'); > so I can later reattach it to the link ? There are a couple of methods, buy you need to change how your function works and understand the difference between an HTML attribute and a DOM element property. The text supplied in the onclick attribute is converted to a function and is called by the onclick handler when a click event occurs. When attached inline, the handler sets the function's this keyword to a reference to the element that the handler belongs to. When attached as a property of a DOM element, browsers like Firefox continue to set this to the element, but browsers like IE don't so this resolves to the global object (per the ECMAScript specification). One way to fix the issue is to use the event object rather than the this keyword so the function can be assigned to other elements simply by assigning it to the appropriate DOM property, e.g. window.onload = function() { var el0 = document.getElementById('a0'); var el1 = document.getElementById('a1'); el1.onclick = el0.onclick; } function foo(evt) { var evt = evt || window.event; if (!evt) return; var el = evt.target || evt.srcElement; alert('id: ' + el.id); } a0 a1 Another method is to use event delegation and listen for the event higher up the DOM tree so you don't need to assign the listener to new elements. -- Rob
[jQuery] jqModal: having trouble centering modal window
Hi, I just downloaded the latest version of jqModal and its accompanying jquery file, but I'm not able to center my modal window using the same style sheet -- http://dev.iceburg.net/jquery/jqModal/jqModal.css . I only changed these lines margin-left: -267px; width: 535px; to reflect the width of my modal window. Here is how I'm displaying it: $(document).ready( function () { $('#editTitle').unbind('click'); $('#modalWindow').jqm({ modal: true, trigger: '#editTitle', autofire: true, focus: true, overlay: 30}, function(h) { $("#modalButtonSave").click (function() { $("#modalWindow").fadeOut("slow"); }); $("#modalButtonCancel").click (function() { $("#modalWindow").fadeOut("slow"); }); $("#modalWindow").fadeIn ("slow"); }); $('#modalWindow').jqmShow(); } ); Any ideas what else I'm doing wrong and why my window is not centering? Thanks, - Dave
[jQuery] Re: Sortable inside an accordion
Hi Pedro, That sounds like a great question for the jQuery UI Google Group. Would you mind posting it there? http://groups.google.com/group/jquery-ui/ Thanks, --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Sep 15, 2009, at 4:04 PM, Pedro wrote: Hi all. I'm trying to place a sortable list inside an accordion and it isn't workig. The list appears outside, below the accordion. Can anyone help me getting this working? Thanks in advance.
[jQuery] Re: How animate in sortable ?
Would you mind posting this question to the jquery-ui google group if you haven't done so already? That group is dedicated to questions such as yours that are specifically related to jQuery UI. http://groups.google.com/group/jquery-ui/ Thanks, --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Sep 15, 2009, at 12:57 PM, Jan Koprowski wrote: Hi ! I'am creating movable panels using jQuery UI sortable behavior. Unfortunately my columns have different size. Question is - how smooth resize panel after dropped it on the column to column size ? Greetings from Poland ! -- Jan Koprowski
[jQuery] Re: How to add a plugin
You should rename the file and remove the .txt from the name. This will make it a proper javascript file. Next you need to reference the touch file in your HTML source. This needs to be done after your inclusion of jQuery on the page. So find on your page a line that looks similar like so: Then reference your jQuery-touch.js file. Keep in mind that you reference your js files relatively so if you saved jquery.touch.js in a scripts directory you should reference it as such: /scripts/jquery.touch.js. Hope that Helps Ralph On Tue, Sep 15, 2009 at 1:52 PM, PokerTec wrote: > > Hi, > > I am completely new to Jquery and not very knowledgable with > javascript in general. I would like to add the jquery.touch plugin to > my website so I can add touch functionality for the Iphone and Ipod > touch. The site is active and is running Jquery 1.26. I am clueless > as to the proper procedure to include the plugin. The download > provided by this site is in a text file. How should I incorporate > this file properly. > > thank you, > > PokerTec >
[jQuery] Re: [ first quest...]
So if I understand what you're trying to do correctly. You want to select the first p tag that has the index of 0 in the matched set AND you want to select all p tags after the 5th index in the same matched set. This will do that: $("p:eq(0), p:gt(5)"); Documentation: http://docs.jquery.com/Selectors/eq#index http://docs.jquery.com/Selectors/gt#index http://docs.jquery.com/Selectors/multiple#selector1selector2selectorN On Tue, Sep 15, 2009 at 8:57 PM, Lord Gustavo Miguel Angel < goosfanc...@gmail.com> wrote: > Hi, > > I have 3 or more label. > How i do to do this: > > if (p:eq(..) == 0) .and. p:eq() > 5) then > ... > endif > > Thank´s >
[jQuery] [ first quest...]
Hi, I have 3 or more label. How i do to do this: if (p:eq(..) == 0) .and. p:eq() > 5) then ... endif Thank´s
[jQuery] Re: Ajax
your first link works find the second one doesnt work because you have the wrong id on your and the id is the same as your On Tue, Sep 15, 2009 at 7:05 PM, Matthew Rolph wrote: > well, i fixed that at least the source shows right now > can you see any probs. now? > > > On Mon, Sep 14, 2009 at 9:15 PM, Steven Yang wrote: > >> hi >> this is all i see in the source of your page >> >> Ajax - jQuery Tests > src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js";> >>
[jQuery] Re: Help with error script
I think the problem is that you only ever remove a node when there is no errors. Why don't you just remove ALL error messages each call - so you'll only ever be showing the most recent error: function(error){ $('.error-message').remove(); //remove ALL previous error messages if(error.length > 0){ // Add error message } } On Sep 16, 1:59 am, "Dave Maharaj :: WidePixels.com" wrote: > I have an ajax function that checks fields to validate and display error > messages. > > There are multiple messages depending on the error per field in some cases, > to short, to long, already taken, invalid, cant be empty and so onyou > get the idea. > > My function is like this: > > function(error) { > > if(error.length != 0) { > > if ( $('#' + fieldName + '-exists').length == 0 ) > { > $('#' + fieldName).after('' + error + ''); > } > > } > else { > $('#' + fieldName + '-exists').remove(); > } > }); > > But the error never changes once 1 is called so if to short it says too > shortfix the problem and it only shows too short never any other > message. How can i remove the message if its fixed but still return > anothererror if it exists? > > I tried if ( $('#' + fieldName + '-exists').length != error ) > so if the error is different display the error but it doesnot remove the > original error > > Ideas? > > Thanks > > Dave
[jQuery] Re: Validate: Focus on first invalid field after validation
Ok, the problem with the non-validated fields submitting on hitting return twice is resolved by removing the following... onfocusout: function(element) { $(element).valid(); }, The problem is, I want this as I want an error to show if they tab through required fields and leave them blank. It doesn't resolve the issue of the first submit still focusing on the last field focused and the second submit then moving the focus. On Sep 16, 10:00 am, Geoffrey wrote: > Not for me. > > In Safari 4 and Firefox 3.5.3 under Snow Leopard and Firefox 3.5.3 > under XP: > > Click in a required field (not the first one) and hit return. Focus > stays in the focused field. Hit return again and the focus jumps to > the first invalid field. > > If you focus a non-required field and hit return, the focus stays in > the non-required field but you do get the error messages for invalid > fields. If you hit return again, the focus jumps to the first invalid > field but then the form submits successfully. > > In Internet Explorer 7 under XP: > > Click in required field (not the first one) and hit return. Focus > stays in the focused field. Hit return again and the focus stays in > the focused field. > > If you focus on a non-required element and hit return, the focus jumps > to the first invalid field. > > On Sep 16, 9:44 am, Jörn Zaefferer > wrote: > > > > > I can't reproduce that. Seems to work fine for me. > > > Jörn > > > On Tue, Sep 15, 2009 at 11:40 PM, Geoffrey > > wrote: > > > > Hmmm...I tried this but I discovered on the first submit that it > > > doesn't focus the first invalid field but it will if I hit return to > > > submit again. > > > > Also, when hitting submit on a field that's not checked for validity, > > > the form will submit successfully this second time as well despite > > > still having invalid fields. > > > > You can test it out using my sample form from the OP. > > > > On Sep 16, 8:37 am, Geoffrey wrote: > > >> Damn. I always forget about :first. > > > >> Thanks. > > > >> On Sep 16, 8:34 am, Jörn Zaefferer > > >> wrote: > > > >> > Something like this? > > > >> > $("form").validate({ > > >> > focusInvalid: false, > > >> > invalidHandler: function() { > > >> > $(this).find(":input.error:first").focus(); > > >> > } > > > >> > }); > > > >> > Jörn > > > >> > On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey > > >> > wrote: > > > >> > > I guess I'm going to have too. I just need to work out how to return > > >> > > the first invalid field so I can set the focus. > > > >> > > On Sep 16, 8:16 am, Jörn Zaefferer > > >> > > wrote: > > >> > >> Well, you can set focusInvalid: false and implement invalidHandler > > >> > >> to > > >> > >> focus the first field. That should do the trick. > > > >> > >> Jörn > > > >> > >> On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey > > >> > >> wrote: > > > >> > >> > And what if you enter an invalid character in an input at the > > >> > >> > bottom > > >> > >> > of the field? For example entering a letter in the Conference > > >> > >> > Dinner > > >> > >> > input of my sample form. > > > >> > >> > A user is going to miss the error message at the top of the form > > >> > >> > along > > >> > >> > with other input errors if there's an error in the last inputs of > > >> > >> > my > > >> > >> > example form and is going to have submit multiple times before > > >> > >> > they > > >> > >> > may even be aware of other errors. > > > >> > >> > I'd expected jumping to the first invalid input to be standard > > >> > >> > behaviour. My fault there I guess. > > > >> > >> > On Sep 15, 10:08 pm, Jörn Zaefferer > > >> > >> > > > >> > >> > wrote: > > >> > >> >> Whats wrong with keeping the focus on the active field, if its > > >> > >> >> invalid? > > > >> > >> >> If you enter something into the, say, third field, hit enter to > > >> > >> >> submit, then it turns out both that field and another before > > >> > >> >> that are > > >> > >> >> invalid, why move the focus to a different field? > > > >> > >> >> Jörn > > > >> > >> >> On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey > > >> > >> >> wrote: > > > >> > >> >> > I've been building up my validation using the jquery > > >> > >> >> > validation plugin > > >> > >> >> > but I can't work out how to get a failed validation to default > > >> > >> >> > the > > >> > >> >> > focus to the first invalid input rather than to the last > > >> > >> >> > selected > > >> > >> >> > input. > > > >> > >> >> > If there is no input field selected, when I submit then a > > >> > >> >> > failed > > >> > >> >> > validation will focus the cursor on the first field but if the > > >> > >> >> > cursor > > >> > >> >> > was left in a field and submitted then the focus stays there > > >> > >> >> > (if it's > > >> > >> >> > invalid) rather than jump to the first invalid input. From > > >> > >> >> > what I've > > >> > >> >> > read and seen, this is the expected behaviour but not what I > > >> > >> >> > want. > > > >> > >> >> > Is there a way I can
[jQuery] Re: A simple .each() function question
Yep, jquery functions apply themselves to all the elements you selected. You only need to use each command if you need to do your own custom handling... Lik um, $("li").each(function(idx){ $(this).css('background-color', '#' + idx + idx + idx); }); Ok, bad example (this sets the background color to a gray scale value relevant to the item's index) ... but you'll often need to do custom stuff that there isn't a jQUery command for (hence the fifty zillion plugins available: nearly all of which use "each" to process each node). Also, the built in commands use "each" internally: for example, here is a (slightly edited for clarity) snippet from the jquery core: jQuery.fn[ "toggleClass" ] = function(){ return this.each( function(){ ...function to toggle class... }, arguments ); }; On Sep 16, 2:30 am, Timid wrote: > I'm a noob trying to get a better understanding of Jquery and have a > simple question about the each() function. > > $("li").click(function () { > $("li").each(function(){ > $(this).toggleClass("example"); > }); > }); > > $("li").click(function () { > $("li").toggleClass("example"); > }); > > What is the added value of using each() in the top example when the > bottom example does the job just fine. Why would you want to use each?
[jQuery] Re: Get the onclick method of an element
I think you need to set the context for the function to that of the link using the JavaScript call function... like: function DoSomething( ctx ){ alert( ctx.text ); } var linky = $('a'); var onclick = $('a').attr('onclick'); onclick.call(linky[0]); // Alerts 'asd' BTW: the linky[0] gets the actual DOM object, rather than the jQUery wrapper. On Sep 16, 3:15 am, sirrocco _ wrote: > Damn ... I somehow thought this would be easy to achive . > > The whole idea was to not change existing code > > Still .. if anyone has any more ideas :). Somehow it seems that this should > be doable. > > On Tue, Sep 15, 2009 at 6:03 PM, MiKiTiE wrote: > > > Ok, I've done some tests and here is my suggestion. > > > First of all, should just ask - I assume you are calling it after the > > element? Probably is obvious, but thought I'd check. > > > Ok, here's the deal: "onclick" is not really an attribute but a mouse > > event. Therefore jQuery will take the contents as a function and write > > it out as an event. The only alternative is to insert your "DoSomething > > (this);" into a standard attribute like "title" or "alt" and then take > > it from there. This way you should be able to insert it exactly as its > > written and not have it converted into an event. > > > Hope this will help? > > > On Sep 15, 2:31 pm, sirrocco wrote: > > > >Perhaps then you can extract it as text like I mentioned in my first > > > > post, then store it in a variable? > > > > How do I extract it like text ? Calling the .text() method, as > > > expected doesn't return what I need - DoSomething(this); > > > > On Sep 15, 3:30 pm,MiKiTiE wrote: > > > > > Perhaps then you can extract it as text like I mentioned in my first > > > > post, then store it in a variable? > > > > > As I am not sure what your function does or why it needs to be applied > > > > this way, I can't solve the problem exactly - but why not just use an > > > > event instead of an onclick in the element? That is what jQuery is > > > > there for :-) > > > > > On Sep 15, 9:50 am, sirrocco wrote: > > > > > > Well .. that's the problem - i tried it like that and it didn't work. > > > > > > When setting the attribute back on the link, the this in DoSomething > > > > > (this); is not the link, but the window. > > > > > > On Sep 15, 11:41 am,MiKiTiE wrote: > > > > > > > Sorry I should have written > > > > > > > $('a').attr('onclick',onclick); > > > > > > > (setting the attribute value not the inner text!) > > > > > > > On Sep 15, 9:09 am, sirrocco wrote: > > > > > > > > Let's say you have a : > > > > > > > > asd > > > > > > > > I want to get the onclick text in a variable - something like > > > > > > > > var onclick = $('a').attr('onclick'); > > > > > > > > The problem is that the onclick variable now is a function and if > > I > > > > > > > try to execute , this wil be the document instead of the link . > > > > > > > > How can I get only the text, so I can later reattach it to the > > link ? > >
[jQuery] Re: selectors, events, and scripted elements not working
Looks like this will work. Thanks for your help. On Sep 15, 4:29 pm, Charlie Griefer wrote: > Have a look at live() > > http://docs.jquery.com/Events/live > > "Binds a handler to an event (like click) for all current - and future - > matched element." > > Basically, when you add elements to the DOM dynamically after page load, > jQuery won't recognize those elements unless the live() method is used. > > > > On Tue, Sep 15, 2009 at 4:20 PM, rob wrote: > > > Hello, > > > I am having some problems with selectors and events. I have a row of > > thumbnails all part of the "thumbnails" class. I'm trying to run some > > code when a thumbnail is clicked, but something weird is happening. > > > When i use this selector/event: > > " $(".thumbnails").click(function(){ // run some code }); > > > nothing happens. > > > I've tested this: > > " $("img").click(function(){ // run some code }); > > > And the code does run on what seems like all that are set in the > > HTML doc, but not the elements that are created from JQuery > > script. > > > Can anyone help to explain this? What am I doing wrong here? > > > For reference: > > > The jquery script creating elements is: > > > $(function(){ > > var image = new Image(); > > > $(img).attr('src', path) > > $(img).attr('class', "thumbnails"); > > > $('#thumbnailwrapper').append(img); > > -- > I have failed as much as I have succeeded. But I love my life. I love my > wife. And I wish you my kind of success.
[jQuery] Re: selectors, events, and scripted elements not working
Looks like this will work. Thanks for your help. On Sep 15, 4:29 pm, Charlie Griefer wrote: > Have a look at live() > > http://docs.jquery.com/Events/live > > "Binds a handler to an event (like click) for all current - and future - > matched element." > > Basically, when you add elements to the DOM dynamically after page load, > jQuery won't recognize those elements unless the live() method is used. > > > > On Tue, Sep 15, 2009 at 4:20 PM, rob wrote: > > > Hello, > > > I am having some problems with selectors and events. I have a row of > > thumbnails all part of the "thumbnails" class. I'm trying to run some > > code when a thumbnail is clicked, but something weird is happening. > > > When i use this selector/event: > > " $(".thumbnails").click(function(){ // run some code }); > > > nothing happens. > > > I've tested this: > > " $("img").click(function(){ // run some code }); > > > And the code does run on what seems like all that are set in the > > HTML doc, but not the elements that are created from JQuery > > script. > > > Can anyone help to explain this? What am I doing wrong here? > > > For reference: > > > The jquery script creating elements is: > > > $(function(){ > > var image = new Image(); > > > $(img).attr('src', path) > > $(img).attr('class', "thumbnails"); > > > $('#thumbnailwrapper').append(img); > > -- > I have failed as much as I have succeeded. But I love my life. I love my > wife. And I wish you my kind of success.
[jQuery] Re: Handling result from the autocomplete plugin
look at the parse function and maybe provide another parse function suitable for your data format. the result trigger will be able to update other fields when you select your choice. On Sun, Sep 13, 2009 at 00:45, Althalos wrote: Hello I'm using the following autocomplete plugin: http://docs.jquery.com/Plugins/Autocomplete It's getting its data from an array, here are the first couple of values: data[0] = "Magnesium (s) | R: 11, 15 | S: 7/8, 43"; data[1] = "Saltsyra 4M (aq) | R: 36/38 | S: 2. 28"; data[2] = "Natriumnitrat | NaNO3 | R: 8, 22"; I have four different input elements: - Name, which triggers the autocomplete - three other ones When the user enters something in name and the choses one of the autosuggested lines, I don't want it to put that entire name into the input window. I to ONLY put the name into it, the name is always the first part of the string, the part before the first |. Then I want to put the information between the first | and the second | into the second input box, the information between the second and third | into the third box, and the information left in the string I want to put into a fourth input element. How can this easiest be achieved? -- alex smime.p7s Description: S/MIME Cryptographic Signature
[jQuery] adding #current position / #total to jquery cycle paginator?
Hi! I was looking this jquery cycle plugin option/paginator: http://malsup.com/jquery/cycle/scrollhv.html it will be too complicated to add a current "#currentslide / #totalslides" between previous/next? you know, to have something like: previous 3 of 9 next best regards, and sorry for the bad english :) luciano
[jQuery] Re: width animation
I realize this has the wrong url for demo. It is here: http://letmehaveblog.blogspot.com/2007/10/haccordion-simple-horizontal-accordion.html Does anyone have any hints about this animation issue? On Sep 11, 6:20 pm, koolkat wrote: > I am using the haccordion plugin which works via a width animation. > However, when an accordion header is on the right side, clicking > another accordion header causes it to move left during the animation > before going back to its correct spot on the right. > The plugin demo and code is here:http://groups.google.com/group/ > jquery- > en/post?hl=en. > If you try the demo, you will see the bounce. It is even more > noticeable on the site I am developing which has larger > headers:http://www.etgfoundation.com/financial-planning-services. The > horizonal accordion is on the top right. > > Any ideas about why this is happening? > > Thanks.
[jQuery] Re: selectors, events, and scripted elements not working
Have a look at live() http://docs.jquery.com/Events/live "Binds a handler to an event (like click) for all current - and future - matched element." Basically, when you add elements to the DOM dynamically after page load, jQuery won't recognize those elements unless the live() method is used. On Tue, Sep 15, 2009 at 4:20 PM, rob wrote: > > Hello, > > I am having some problems with selectors and events. I have a row of > thumbnails all part of the "thumbnails" class. I'm trying to run some > code when a thumbnail is clicked, but something weird is happening. > > When i use this selector/event: > " $(".thumbnails").click(function(){ // run some code }); > > nothing happens. > > I've tested this: > " $("img").click(function(){ // run some code }); > > And the code does run on what seems like all that are set in the > HTML doc, but not the elements that are created from JQuery > script. > > Can anyone help to explain this? What am I doing wrong here? > > For reference: > > The jquery script creating elements is: > > $(function(){ > var image = new Image(); > > $(img).attr('src', path) > $(img).attr('class', "thumbnails"); > > $('#thumbnailwrapper').append(img); > -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: IE 8 chokes on HTML5 elements inserted with jQuery
Unfortunately, IE still chokes even if inserting the elements individually with chained appends like Ricardo described. I've been fooling around with it for a couple hours and haven't come up with a syntax that will make it parse correctly. I'm going to try each append as a separate statement instead of chaining them as a last resort. If that doesn't work, I think I may have to give up on using HTML5 for this for now - it's not worth the time it's taking. : ( Thanks again for the help. On Sep 15, 2:35 pm, Perceptes wrote: > Fantastic!! Thanks for those excellent replies! Much appreciated. :D > > On Sep 15, 12:07 pm, Ricardo wrote: > > > > > Regarding #1, he is already doing that (in html5.js). IE fails to > > parse the new elements in innerHTML even after introducing the new > > tags via createElement. > > > #2 works fine. If you provide jQuery a single tag then it will use > > createElement, ex: > > > $('') > > .append( $('').append( $(' > href="http://www.w3.org";>Guest') ) > > .append( $('').append( $('This is the comment > p>') ) ); > > > cheers > > Ricardo > > > On Sep 15, 9:29 am, Nick Fitzsimons wrote: > > > > 2009/9/15 Perceptes : > > > > > I've encountered a problem with the combination of jQuery, IE, and > > > > HTML5 elements. HTML5 elements inserted into the page after initial > > > > load via jQuery's DOM manipulation functions are not parsed correctly > > > > by IE, even with Remy Sharp's HTML5 shiv script. > > > > The problem is that jQuery uses innerHTML, rather than DOM methods, to > > > insert the new content (which is why it's passed to jQuery as a > > > string). This means it relies on IE's HTML parser to correctly parse > > > the markup from the string when it is inserted. > > > > When IE's parser encounters an element it doesn't recognise the name > > > of, it creates the element as an empty element (similar to or > > > ), then parses the content as if it were sibling nodes, then > > > creates an empty element whose name begins with a slash (/ARTICLE for > > > example); you can see this on your test page by clicking on the "IE > > > fail" button and then entering: > > > > > ame)> > > > and > > > > > me)> > > > in the location bar; the first will show "ARTICLE", and the second > > > will show "/ARTICLE". > > > > To work around this you basically have two options: > > > > 1. Before any other script is executed, add the line: > > > document.createElement("article"); > > > and add equivalent lines for any other HTML5-specific elements you > > > wish to use (such as section). This prompts IE's HTML parser to expect > > > blocks with that tagName and it will then parse them correctly. > > > > 2. Don't use jQuery's innerHTML-dependent approach to creating new > > > content; instead, use DOM creation methods directly, for example: > > > > var article = document.createElement("article"); > > > var header = article.appendChild(document.createElement("header")); > > > header.appendChild(document.createTextNode("Hello World"); > > > > var container = document.getElementsByTagName("div")[0]; > > > container.insertBefore(article, container .getElementsByTagName("h2")[1]); > > > > ... and so on. (Actually, you can use jQuery for selecting the correct > > > insertion point and for inserting the new elements there, as jQuery > > > can cope with elements when inserting content.) > > > > Regards, > > > > Nick. > > > -- > > > Nick Fitzsimonshttp://www.nickfitz.co.uk/
[jQuery] selectors, events, and scripted elements not working
Hello, I am having some problems with selectors and events. I have a row of thumbnails all part of the "thumbnails" class. I'm trying to run some code when a thumbnail is clicked, but something weird is happening. When i use this selector/event: " $(".thumbnails").click(function(){ // run some code }); nothing happens. I've tested this: " $("img").click(function(){ // run some code }); And the code does run on what seems like all that are set in the HTML doc, but not the elements that are created from JQuery script. Can anyone help to explain this? What am I doing wrong here? For reference: The jquery script creating elements is: $(function(){ var image = new Image(); $(img).attr('src', path) $(img).attr('class', "thumbnails"); $('#thumbnailwrapper').append(img);
[jQuery] Re: append script in ajax cross domain on success function is not working.(script not excuting)
sry about the format, i ll paste it again and make it easy to read. PS: i think i know why it isn't working, i suspect after the success ajax call, the page has already been loaded, and append script to flash div didn't actually run the script. now i am wondering, is it possible to get some script from server response and execute the script after the page has been loaded?? any help will be appreciated. /*in page header/ var flashHTML; $.ajax({ url: "crossdomainURL", data: { 'ClientID': '100', 'CatID': '11', 'LessonID': null, 'ClientUserID': null }, contentType: "application/json; charset=utf-8", dataType: "jsonp", success: function(data, textStatus) { //alert(data); //alert(data.d);//NOTE: i can get the return data here. //alert(JSON.stringify(data)); flashHTML = data.d; //$("#flash").append(flashHTML); //Note: if I uncomment this line here, the html part of the flashHTML // will be shown on the page but the script will not excute. }, error: function(err) { alert("errr"); } }); /*in page body/ setTimeout("showFlash()", 500);// Setup a time delay, because the flashHTML is obtained from an ajax call, it will NOT // be rdy without the delay. function showFlash() { $("#flash").append(flashHTML); // If i append the flashHTML here, the script inside the flashHTML will be excuted. // if i comment this out and put it inside the success function of the ajax call, it doesn't // work. }
[jQuery] Re: jQuery cycle IE issue
Try adding style rules for the anchors - they are the actual slides in your case: #slideshow1 a { height: 463px; width: 841px; display: block; } Mike On Sep 15, 5:00 pm, kcory wrote: > Hi, > > I've tried implementing jQuery cycle on my portfolio and it works in FF3 and > Safari but not in IE. I've spent 24 hours researching and I just don't know > how to fix it. I've checked for commas, I've tried altering the cleartype > and cleartypeNoBg because I'm using .pngs but that still doesn't make a > difference. I've disabled all of my other jquery scripts and it still > doesn't work. > > I have 4 images in my slideshow and the first image shows but I think the > problem is that in IE the height and width of the rest of the images is set > to 0px. I'm also getting the error '[cycle] DOM not ready, queuing > slideshow' > > This is my jQuery: > > > > src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js";> > > > > > > > > > > $(document).ready(function(){ > $("#slider").easySlider({ > controlsBefore: '', > controlsAfter: '
', > auto: false, > continuous: false > }); > > $("#slider2").easySlider({ > controlsBefore: '', > controlsAfter: '
', > prevId: 'prevBtn2', > nextId: 'nextBtn2' > }); > }); > > > > > > > > $('#slideshow1').cycle({ > fx: 'fade', > cleartype: true, > speed: 1000, > timeout: 0, > prev: '#prev', > next: '#next' > }); > > $('#slideshow2').cycle({ > fx: 'fade', > cleartype: true, > speed: 1000, > timeout: 0, > prev: '#prev2', > next: '#next2' > }); > > > > This is my css: > > .slideshow-image { > margin: 63px 0 0 57px; > position: absolute; > display: block; > > } > > .pics { > height: 463px; > width: 841px; > padding:0; > margin:0; > overflow: hidden > > } > > .pics img { > height: 463px; > width: 841px; > padding: 0px; > border: none; > top:0; > left:0 > > } > > All of this is fromhttp://www.katherinecory.com. Does anyone have any > ideas? I'd be eternally grateful if you do! > > Thank you. > -- > View this message in > context:http://www.nabble.com/jQuery-cycle-IE-issue-tp25457791s27240p25457791... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] A simple .each() function question
I'm a noob trying to get a better understanding of Jquery and have a simple question about the each() function. $("li").click(function () { $("li").each(function(){ $(this).toggleClass("example"); }); }); $("li").click(function () { $("li").toggleClass("example"); }); What is the added value of using each() in the top example when the bottom example does the job just fine. Why would you want to use each?
[jQuery] Looking for Content Slider
Hello everybody, I googled a lot but I have not found anything I cloud need. I want to slide different s, for example like on http://www.gimiti.com/kltan/demo/jFlow/ but I have 2 requirements: - my divs have DIFFERENT HEIGHTs. So the height must be variable. (That is the real problem) - it should identify and slide through all s automatically because I will often change the number. (That is fulfilled by most sliders I found). Does anybody know a solution? Bye, Mario.
[jQuery] How to add a plugin
Hi, I am completely new to Jquery and not very knowledgable with javascript in general. I would like to add the jquery.touch plugin to my website so I can add touch functionality for the Iphone and Ipod touch. The site is active and is running Jquery 1.26. I am clueless as to the proper procedure to include the plugin. The download provided by this site is in a text file. How should I incorporate this file properly. thank you, PokerTec
[jQuery] Sortable inside an accordion
Hi all. I'm trying to place a sortable list inside an accordion and it isn't workig. The list appears outside, below the accordion. Can anyone help me getting this working? Thanks in advance.
[jQuery] How animate in sortable ?
Hi ! I'am creating movable panels using jQuery UI sortable behavior. Unfortunately my columns have different size. Question is - how smooth resize panel after dropped it on the column to column size ? Greetings from Poland ! -- Jan Koprowski
[jQuery] Light box modification
i have situation which needs to be implemented . onclick of the Image in lightbox , it should got the specified URL . Does anyone have idea of implementing it inside the JS file Thanks
[jQuery] jQuery cycle IE issue
Hi, I've tried implementing jQuery cycle on my portfolio and it works in FF3 and Safari but not in IE. I've spent 24 hours researching and I just don't know how to fix it. I've checked for commas, I've tried altering the cleartype and cleartypeNoBg because I'm using .pngs but that still doesn't make a difference. I've disabled all of my other jquery scripts and it still doesn't work. I have 4 images in my slideshow and the first image shows but I think the problem is that in IE the height and width of the rest of the images is set to 0px. I'm also getting the error '[cycle] DOM not ready, queuing slideshow' This is my jQuery: http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js";> $(document).ready(function(){ $("#slider").easySlider({ controlsBefore: '', controlsAfter: '
', auto: false, continuous: false }); $("#slider2").easySlider({ controlsBefore: '', controlsAfter: '
', prevId: 'prevBtn2', nextId: 'nextBtn2' }); }); $('#slideshow1').cycle({ fx: 'fade', cleartype: true, speed: 1000, timeout: 0, prev: '#prev', next: '#next' }); $('#slideshow2').cycle({ fx: 'fade', cleartype: true, speed: 1000, timeout: 0, prev: '#prev2', next: '#next2' }); This is my css: .slideshow-image { margin: 63px 0 0 57px; position: absolute; display: block; } .pics { height: 463px; width: 841px; padding:0; margin:0; overflow: hidden } .pics img { height: 463px; width: 841px; padding: 0px; border: none; top:0; left:0 } All of this is from http://www.katherinecory.com. Does anyone have any ideas? I'd be eternally grateful if you do! Thank you. -- View this message in context: http://www.nabble.com/jQuery-cycle-IE-issue-tp25457791s27240p25457791.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] [tooltip] Links in tiptool message
Hi, I'm novice with jQuery and after evaluating the jQuery-Tiptool plugin available in http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/, and I wonder if it's possible to put a link inside the tooltip message. The user would see the tooltip and click the link. Obviously the tiptool should not move along with the mouse! :) Thanks
[jQuery] "Object doesn't support this property or method" in IE
Hello everyone, I have the following code that works great in Firefox, Opera, Safari, but fails to work in IE. Can anyone take a look and maybe tell me what I'm doing wrong? Thanks! function updateStatus(){ jQuery(function(){ $("#prov1hCount").load("source/provStats.php #prov1hCount"); $("#prov1hOntime").load("source/provStats.php #prov1hOntime"); $("#prov1hLate").load("source/provStats.php #prov1hLate"); $("#prov1hPuAverage").load("source/provStats.php #prov1hPuAverage"); $("#prov1hMTDPuAverage").load("source/provStats.php #prov1hMTDPuAverage"); $("#prov2hCount").load("source/provStats.php #prov2hCount"); $("#prov2hOntime").load("source/provStats.php #prov2hOntime"); $("#prov2hLate").load("source/provStats.php #prov2hLate"); $("#prov2hPuAverage").load("source/provStats.php #prov2hPuAverage"); $("#prov2hDelAverage").load("source/provStats.php #prov2hDelAverage"); $("#prov2hMTDPuAverage").load("source/provStats.php #prov2hMTDPuAverage"); }); setTimeout("updateStatus()",2); } ... $(document).ready(updateStatus());
[jQuery] Re: Validate: Focus on first invalid field after validation
Not for me. In Safari 4 and Firefox 3.5.3 under Snow Leopard and Firefox 3.5.3 under XP: Click in a required field (not the first one) and hit return. Focus stays in the focused field. Hit return again and the focus jumps to the first invalid field. If you focus a non-required field and hit return, the focus stays in the non-required field but you do get the error messages for invalid fields. If you hit return again, the focus jumps to the first invalid field but then the form submits successfully. In Internet Explorer 7 under XP: Click in required field (not the first one) and hit return. Focus stays in the focused field. Hit return again and the focus stays in the focused field. If you focus on a non-required element and hit return, the focus jumps to the first invalid field. On Sep 16, 9:44 am, Jörn Zaefferer wrote: > I can't reproduce that. Seems to work fine for me. > > Jörn > > > > On Tue, Sep 15, 2009 at 11:40 PM, Geoffrey wrote: > > > Hmmm...I tried this but I discovered on the first submit that it > > doesn't focus the first invalid field but it will if I hit return to > > submit again. > > > Also, when hitting submit on a field that's not checked for validity, > > the form will submit successfully this second time as well despite > > still having invalid fields. > > > You can test it out using my sample form from the OP. > > > On Sep 16, 8:37 am, Geoffrey wrote: > >> Damn. I always forget about :first. > > >> Thanks. > > >> On Sep 16, 8:34 am, Jörn Zaefferer > >> wrote: > > >> > Something like this? > > >> > $("form").validate({ > >> > focusInvalid: false, > >> > invalidHandler: function() { > >> > $(this).find(":input.error:first").focus(); > >> > } > > >> > }); > > >> > Jörn > > >> > On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey > >> > wrote: > > >> > > I guess I'm going to have too. I just need to work out how to return > >> > > the first invalid field so I can set the focus. > > >> > > On Sep 16, 8:16 am, Jörn Zaefferer > >> > > wrote: > >> > >> Well, you can set focusInvalid: false and implement invalidHandler to > >> > >> focus the first field. That should do the trick. > > >> > >> Jörn > > >> > >> On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey > >> > >> wrote: > > >> > >> > And what if you enter an invalid character in an input at the bottom > >> > >> > of the field? For example entering a letter in the Conference Dinner > >> > >> > input of my sample form. > > >> > >> > A user is going to miss the error message at the top of the form > >> > >> > along > >> > >> > with other input errors if there's an error in the last inputs of my > >> > >> > example form and is going to have submit multiple times before they > >> > >> > may even be aware of other errors. > > >> > >> > I'd expected jumping to the first invalid input to be standard > >> > >> > behaviour. My fault there I guess. > > >> > >> > On Sep 15, 10:08 pm, Jörn Zaefferer > >> > >> > wrote: > >> > >> >> Whats wrong with keeping the focus on the active field, if its > >> > >> >> invalid? > > >> > >> >> If you enter something into the, say, third field, hit enter to > >> > >> >> submit, then it turns out both that field and another before that > >> > >> >> are > >> > >> >> invalid, why move the focus to a different field? > > >> > >> >> Jörn > > >> > >> >> On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey > >> > >> >> wrote: > > >> > >> >> > I've been building up my validation using the jquery validation > >> > >> >> > plugin > >> > >> >> > but I can't work out how to get a failed validation to default > >> > >> >> > the > >> > >> >> > focus to the first invalid input rather than to the last selected > >> > >> >> > input. > > >> > >> >> > If there is no input field selected, when I submit then a failed > >> > >> >> > validation will focus the cursor on the first field but if the > >> > >> >> > cursor > >> > >> >> > was left in a field and submitted then the focus stays there (if > >> > >> >> > it's > >> > >> >> > invalid) rather than jump to the first invalid input. From what > >> > >> >> > I've > >> > >> >> > read and seen, this is the expected behaviour but not what I > >> > >> >> > want. > > >> > >> >> > Is there a way I can get the first invalid field and set the > >> > >> >> > focus to > >> > >> >> > that? > > >> > >> >> > A demo of what I have built up so far can be seen at > >> > >> >> >https://webdev2.otago.ac.nz/oihrn2009/ > > >> > >> >> > All my jquery validation can be found in > >> > >> >> >https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js
[jQuery] Re: Validate: Focus on first invalid field after validation
I can't reproduce that. Seems to work fine for me. Jörn On Tue, Sep 15, 2009 at 11:40 PM, Geoffrey wrote: > > Hmmm...I tried this but I discovered on the first submit that it > doesn't focus the first invalid field but it will if I hit return to > submit again. > > Also, when hitting submit on a field that's not checked for validity, > the form will submit successfully this second time as well despite > still having invalid fields. > > You can test it out using my sample form from the OP. > > > On Sep 16, 8:37 am, Geoffrey wrote: >> Damn. I always forget about :first. >> >> Thanks. >> >> On Sep 16, 8:34 am, Jörn Zaefferer >> wrote: >> >> >> >> > Something like this? >> >> > $("form").validate({ >> > focusInvalid: false, >> > invalidHandler: function() { >> > $(this).find(":input.error:first").focus(); >> > } >> >> > }); >> >> > Jörn >> >> > On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey >> > wrote: >> >> > > I guess I'm going to have too. I just need to work out how to return >> > > the first invalid field so I can set the focus. >> >> > > On Sep 16, 8:16 am, Jörn Zaefferer >> > > wrote: >> > >> Well, you can set focusInvalid: false and implement invalidHandler to >> > >> focus the first field. That should do the trick. >> >> > >> Jörn >> >> > >> On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey >> > >> wrote: >> >> > >> > And what if you enter an invalid character in an input at the bottom >> > >> > of the field? For example entering a letter in the Conference Dinner >> > >> > input of my sample form. >> >> > >> > A user is going to miss the error message at the top of the form along >> > >> > with other input errors if there's an error in the last inputs of my >> > >> > example form and is going to have submit multiple times before they >> > >> > may even be aware of other errors. >> >> > >> > I'd expected jumping to the first invalid input to be standard >> > >> > behaviour. My fault there I guess. >> >> > >> > On Sep 15, 10:08 pm, Jörn Zaefferer >> > >> > wrote: >> > >> >> Whats wrong with keeping the focus on the active field, if its >> > >> >> invalid? >> >> > >> >> If you enter something into the, say, third field, hit enter to >> > >> >> submit, then it turns out both that field and another before that are >> > >> >> invalid, why move the focus to a different field? >> >> > >> >> Jörn >> >> > >> >> On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey >> > >> >> wrote: >> >> > >> >> > I've been building up my validation using the jquery validation >> > >> >> > plugin >> > >> >> > but I can't work out how to get a failed validation to default the >> > >> >> > focus to the first invalid input rather than to the last selected >> > >> >> > input. >> >> > >> >> > If there is no input field selected, when I submit then a failed >> > >> >> > validation will focus the cursor on the first field but if the >> > >> >> > cursor >> > >> >> > was left in a field and submitted then the focus stays there (if >> > >> >> > it's >> > >> >> > invalid) rather than jump to the first invalid input. From what >> > >> >> > I've >> > >> >> > read and seen, this is the expected behaviour but not what I want. >> >> > >> >> > Is there a way I can get the first invalid field and set the focus >> > >> >> > to >> > >> >> > that? >> >> > >> >> > A demo of what I have built up so far can be seen at >> > >> >> >https://webdev2.otago.ac.nz/oihrn2009/ >> >> > >> >> > All my jquery validation can be found in >> > >> >> >https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js
[jQuery] Re: Validate: Focus on first invalid field after validation
Hmmm...I tried this but I discovered on the first submit that it doesn't focus the first invalid field but it will if I hit return to submit again. Also, when hitting submit on a field that's not checked for validity, the form will submit successfully this second time as well despite still having invalid fields. You can test it out using my sample form from the OP. On Sep 16, 8:37 am, Geoffrey wrote: > Damn. I always forget about :first. > > Thanks. > > On Sep 16, 8:34 am, Jörn Zaefferer > wrote: > > > > > Something like this? > > > $("form").validate({ > > focusInvalid: false, > > invalidHandler: function() { > > $(this).find(":input.error:first").focus(); > > } > > > }); > > > Jörn > > > On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey > > wrote: > > > > I guess I'm going to have too. I just need to work out how to return > > > the first invalid field so I can set the focus. > > > > On Sep 16, 8:16 am, Jörn Zaefferer > > > wrote: > > >> Well, you can set focusInvalid: false and implement invalidHandler to > > >> focus the first field. That should do the trick. > > > >> Jörn > > > >> On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey > > >> wrote: > > > >> > And what if you enter an invalid character in an input at the bottom > > >> > of the field? For example entering a letter in the Conference Dinner > > >> > input of my sample form. > > > >> > A user is going to miss the error message at the top of the form along > > >> > with other input errors if there's an error in the last inputs of my > > >> > example form and is going to have submit multiple times before they > > >> > may even be aware of other errors. > > > >> > I'd expected jumping to the first invalid input to be standard > > >> > behaviour. My fault there I guess. > > > >> > On Sep 15, 10:08 pm, Jörn Zaefferer > > >> > wrote: > > >> >> Whats wrong with keeping the focus on the active field, if its > > >> >> invalid? > > > >> >> If you enter something into the, say, third field, hit enter to > > >> >> submit, then it turns out both that field and another before that are > > >> >> invalid, why move the focus to a different field? > > > >> >> Jörn > > > >> >> On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey > > >> >> wrote: > > > >> >> > I've been building up my validation using the jquery validation > > >> >> > plugin > > >> >> > but I can't work out how to get a failed validation to default the > > >> >> > focus to the first invalid input rather than to the last selected > > >> >> > input. > > > >> >> > If there is no input field selected, when I submit then a failed > > >> >> > validation will focus the cursor on the first field but if the > > >> >> > cursor > > >> >> > was left in a field and submitted then the focus stays there (if > > >> >> > it's > > >> >> > invalid) rather than jump to the first invalid input. From what > > >> >> > I've > > >> >> > read and seen, this is the expected behaviour but not what I want. > > > >> >> > Is there a way I can get the first invalid field and set the focus > > >> >> > to > > >> >> > that? > > > >> >> > A demo of what I have built up so far can be seen at > > >> >> >https://webdev2.otago.ac.nz/oihrn2009/ > > > >> >> > All my jquery validation can be found in > > >> >> >https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js
[jQuery] Re: IE 8 chokes on HTML5 elements inserted with jQuery
Fantastic!! Thanks for those excellent replies! Much appreciated. :D On Sep 15, 12:07 pm, Ricardo wrote: > Regarding #1, he is already doing that (in html5.js). IE fails to > parse the new elements in innerHTML even after introducing the new > tags via createElement. > > #2 works fine. If you provide jQuery a single tag then it will use > createElement, ex: > > $('') > .append( $('').append( $('http://www.w3.org";>Guest') ) > .append( $('').append( $('This is the comment p>') ) ); > > cheers > Ricardo > > On Sep 15, 9:29 am, Nick Fitzsimons wrote: > > > > > 2009/9/15 Perceptes : > > > > I've encountered a problem with the combination of jQuery, IE, and > > > HTML5 elements. HTML5 elements inserted into the page after initial > > > load via jQuery's DOM manipulation functions are not parsed correctly > > > by IE, even with Remy Sharp's HTML5 shiv script. > > > The problem is that jQuery uses innerHTML, rather than DOM methods, to > > insert the new content (which is why it's passed to jQuery as a > > string). This means it relies on IE's HTML parser to correctly parse > > the markup from the string when it is inserted. > > > When IE's parser encounters an element it doesn't recognise the name > > of, it creates the element as an empty element (similar to or > > ), then parses the content as if it were sibling nodes, then > > creates an empty element whose name begins with a slash (/ARTICLE for > > example); you can see this on your test page by clicking on the "IE > > fail" button and then entering: > > > ame)> > > and > > > me)> > > in the location bar; the first will show "ARTICLE", and the second > > will show "/ARTICLE". > > > To work around this you basically have two options: > > > 1. Before any other script is executed, add the line: > > document.createElement("article"); > > and add equivalent lines for any other HTML5-specific elements you > > wish to use (such as section). This prompts IE's HTML parser to expect > > blocks with that tagName and it will then parse them correctly. > > > 2. Don't use jQuery's innerHTML-dependent approach to creating new > > content; instead, use DOM creation methods directly, for example: > > > var article = document.createElement("article"); > > var header = article.appendChild(document.createElement("header")); > > header.appendChild(document.createTextNode("Hello World"); > > > var container = document.getElementsByTagName("div")[0]; > > container.insertBefore(article, container .getElementsByTagName("h2")[1]); > > > ... and so on. (Actually, you can use jQuery for selecting the correct > > insertion point and for inserting the new elements there, as jQuery > > can cope with elements when inserting content.) > > > Regards, > > > Nick. > > -- > > Nick Fitzsimonshttp://www.nickfitz.co.uk/
[jQuery] Re: (validate) email validator
Yep. The goal here is to indicate to the user that he mistyped his address. For that to work reliably, the validation must accept all valid addresses, not just those that feel more valid then others. Jörn On Tue, Sep 15, 2009 at 10:39 PM, Scott Haneda wrote: > > Right, this is sort of a long debate, which I see pop up on mailing lists > for email servers. In the end, I think you need to go by the standards. > > Just because hotmail breaks the rules, does not mean you want to punish some > other user who does not use hotmail, just because they use a character in > their email address that hotmail does not. > > On Sep 14, 2009, at 6:04 PM, Sean McKenna wrote: > >> While technically this is correct, a more restrictive approach might >> be preferable because some email services (hotmail for one) will not >> send to an email address using anything other than alphanumerics, >> dots, hyphens, and underscores. > > -- > Scott * If you contact me off list replace talklists@ with scott@ * > >
[jQuery] Re: (validate) email validator
Right, this is sort of a long debate, which I see pop up on mailing lists for email servers. In the end, I think you need to go by the standards. Just because hotmail breaks the rules, does not mean you want to punish some other user who does not use hotmail, just because they use a character in their email address that hotmail does not. On Sep 14, 2009, at 6:04 PM, Sean McKenna wrote: While technically this is correct, a more restrictive approach might be preferable because some email services (hotmail for one) will not send to an email address using anything other than alphanumerics, dots, hyphens, and underscores. -- Scott * If you contact me off list replace talklists@ with scott@ *
[jQuery] Re: Validate: Focus on first invalid field after validation
Damn. I always forget about :first. Thanks. On Sep 16, 8:34 am, Jörn Zaefferer wrote: > Something like this? > > $("form").validate({ > focusInvalid: false, > invalidHandler: function() { > $(this).find(":input.error:first").focus(); > } > > }); > > Jörn > > > > On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey wrote: > > > I guess I'm going to have too. I just need to work out how to return > > the first invalid field so I can set the focus. > > > On Sep 16, 8:16 am, Jörn Zaefferer > > wrote: > >> Well, you can set focusInvalid: false and implement invalidHandler to > >> focus the first field. That should do the trick. > > >> Jörn > > >> On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey > >> wrote: > > >> > And what if you enter an invalid character in an input at the bottom > >> > of the field? For example entering a letter in the Conference Dinner > >> > input of my sample form. > > >> > A user is going to miss the error message at the top of the form along > >> > with other input errors if there's an error in the last inputs of my > >> > example form and is going to have submit multiple times before they > >> > may even be aware of other errors. > > >> > I'd expected jumping to the first invalid input to be standard > >> > behaviour. My fault there I guess. > > >> > On Sep 15, 10:08 pm, Jörn Zaefferer > >> > wrote: > >> >> Whats wrong with keeping the focus on the active field, if its invalid? > > >> >> If you enter something into the, say, third field, hit enter to > >> >> submit, then it turns out both that field and another before that are > >> >> invalid, why move the focus to a different field? > > >> >> Jörn > > >> >> On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey > >> >> wrote: > > >> >> > I've been building up my validation using the jquery validation plugin > >> >> > but I can't work out how to get a failed validation to default the > >> >> > focus to the first invalid input rather than to the last selected > >> >> > input. > > >> >> > If there is no input field selected, when I submit then a failed > >> >> > validation will focus the cursor on the first field but if the cursor > >> >> > was left in a field and submitted then the focus stays there (if it's > >> >> > invalid) rather than jump to the first invalid input. From what I've > >> >> > read and seen, this is the expected behaviour but not what I want. > > >> >> > Is there a way I can get the first invalid field and set the focus to > >> >> > that? > > >> >> > A demo of what I have built up so far can be seen at > >> >> >https://webdev2.otago.ac.nz/oihrn2009/ > > >> >> > All my jquery validation can be found in > >> >> >https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js
[jQuery] Re: Validate: Focus on first invalid field after validation
Something like this? $("form").validate({ focusInvalid: false, invalidHandler: function() { $(this).find(":input.error:first").focus(); } }); Jörn On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey wrote: > > I guess I'm going to have too. I just need to work out how to return > the first invalid field so I can set the focus. > > > > On Sep 16, 8:16 am, Jörn Zaefferer > wrote: >> Well, you can set focusInvalid: false and implement invalidHandler to >> focus the first field. That should do the trick. >> >> Jörn >> >> >> >> On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey wrote: >> >> > And what if you enter an invalid character in an input at the bottom >> > of the field? For example entering a letter in the Conference Dinner >> > input of my sample form. >> >> > A user is going to miss the error message at the top of the form along >> > with other input errors if there's an error in the last inputs of my >> > example form and is going to have submit multiple times before they >> > may even be aware of other errors. >> >> > I'd expected jumping to the first invalid input to be standard >> > behaviour. My fault there I guess. >> >> > On Sep 15, 10:08 pm, Jörn Zaefferer >> > wrote: >> >> Whats wrong with keeping the focus on the active field, if its invalid? >> >> >> If you enter something into the, say, third field, hit enter to >> >> submit, then it turns out both that field and another before that are >> >> invalid, why move the focus to a different field? >> >> >> Jörn >> >> >> On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey >> >> wrote: >> >> >> > I've been building up my validation using the jquery validation plugin >> >> > but I can't work out how to get a failed validation to default the >> >> > focus to the first invalid input rather than to the last selected >> >> > input. >> >> >> > If there is no input field selected, when I submit then a failed >> >> > validation will focus the cursor on the first field but if the cursor >> >> > was left in a field and submitted then the focus stays there (if it's >> >> > invalid) rather than jump to the first invalid input. From what I've >> >> > read and seen, this is the expected behaviour but not what I want. >> >> >> > Is there a way I can get the first invalid field and set the focus to >> >> > that? >> >> >> > A demo of what I have built up so far can be seen at >> >> >https://webdev2.otago.ac.nz/oihrn2009/ >> >> >> > All my jquery validation can be found in >> >> >https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js
[jQuery] Re: Validate: Focus on first invalid field after validation
I guess I'm going to have too. I just need to work out how to return the first invalid field so I can set the focus. On Sep 16, 8:16 am, Jörn Zaefferer wrote: > Well, you can set focusInvalid: false and implement invalidHandler to > focus the first field. That should do the trick. > > Jörn > > > > On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey wrote: > > > And what if you enter an invalid character in an input at the bottom > > of the field? For example entering a letter in the Conference Dinner > > input of my sample form. > > > A user is going to miss the error message at the top of the form along > > with other input errors if there's an error in the last inputs of my > > example form and is going to have submit multiple times before they > > may even be aware of other errors. > > > I'd expected jumping to the first invalid input to be standard > > behaviour. My fault there I guess. > > > On Sep 15, 10:08 pm, Jörn Zaefferer > > wrote: > >> Whats wrong with keeping the focus on the active field, if its invalid? > > >> If you enter something into the, say, third field, hit enter to > >> submit, then it turns out both that field and another before that are > >> invalid, why move the focus to a different field? > > >> Jörn > > >> On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey wrote: > > >> > I've been building up my validation using the jquery validation plugin > >> > but I can't work out how to get a failed validation to default the > >> > focus to the first invalid input rather than to the last selected > >> > input. > > >> > If there is no input field selected, when I submit then a failed > >> > validation will focus the cursor on the first field but if the cursor > >> > was left in a field and submitted then the focus stays there (if it's > >> > invalid) rather than jump to the first invalid input. From what I've > >> > read and seen, this is the expected behaviour but not what I want. > > >> > Is there a way I can get the first invalid field and set the focus to > >> > that? > > >> > A demo of what I have built up so far can be seen at > >> >https://webdev2.otago.ac.nz/oihrn2009/ > > >> > All my jquery validation can be found in > >> >https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js
[jQuery] Re: each() needs documentation
Yes, I really looked for it - in traversing, manipulation, and also core. But probably somehow skipped over where it was. Thank you for the link!
[jQuery] Re: SimpleModal 1.3 height
Warren, Can you send me (or better yet create an issue[1]) with a working code sample of the issue you are having? Thanks, Eric [1] http://code.google.com/p/simplemodal/issues/list On Sep 15, 12:09 pm, Warren Benedetto wrote: > Figured it out myself, so I'm posting for anyone else with this > problem. Adding !important to the height specified in my stylesheet > overrides the inline style. Not sure if that's the best solution, but > it works.
[jQuery] Re: Validate: Focus on first invalid field after validation
Well, you can set focusInvalid: false and implement invalidHandler to focus the first field. That should do the trick. Jörn On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey wrote: > > And what if you enter an invalid character in an input at the bottom > of the field? For example entering a letter in the Conference Dinner > input of my sample form. > > A user is going to miss the error message at the top of the form along > with other input errors if there's an error in the last inputs of my > example form and is going to have submit multiple times before they > may even be aware of other errors. > > I'd expected jumping to the first invalid input to be standard > behaviour. My fault there I guess. > > > > > On Sep 15, 10:08 pm, Jörn Zaefferer > wrote: >> Whats wrong with keeping the focus on the active field, if its invalid? >> >> If you enter something into the, say, third field, hit enter to >> submit, then it turns out both that field and another before that are >> invalid, why move the focus to a different field? >> >> Jörn >> >> >> >> On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey wrote: >> >> > I've been building up my validation using the jquery validation plugin >> > but I can't work out how to get a failed validation to default the >> > focus to the first invalid input rather than to the last selected >> > input. >> >> > If there is no input field selected, when I submit then a failed >> > validation will focus the cursor on the first field but if the cursor >> > was left in a field and submitted then the focus stays there (if it's >> > invalid) rather than jump to the first invalid input. From what I've >> > read and seen, this is the expected behaviour but not what I want. >> >> > Is there a way I can get the first invalid field and set the focus to >> > that? >> >> > A demo of what I have built up so far can be seen at >> >https://webdev2.otago.ac.nz/oihrn2009/ >> >> > All my jquery validation can be found in >> >https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js
[jQuery] Re: Validate: Focus on first invalid field after validation
And what if you enter an invalid character in an input at the bottom of the field? For example entering a letter in the Conference Dinner input of my sample form. A user is going to miss the error message at the top of the form along with other input errors if there's an error in the last inputs of my example form and is going to have submit multiple times before they may even be aware of other errors. I'd expected jumping to the first invalid input to be standard behaviour. My fault there I guess. On Sep 15, 10:08 pm, Jörn Zaefferer wrote: > Whats wrong with keeping the focus on the active field, if its invalid? > > If you enter something into the, say, third field, hit enter to > submit, then it turns out both that field and another before that are > invalid, why move the focus to a different field? > > Jörn > > > > On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey wrote: > > > I've been building up my validation using the jquery validation plugin > > but I can't work out how to get a failed validation to default the > > focus to the first invalid input rather than to the last selected > > input. > > > If there is no input field selected, when I submit then a failed > > validation will focus the cursor on the first field but if the cursor > > was left in a field and submitted then the focus stays there (if it's > > invalid) rather than jump to the first invalid input. From what I've > > read and seen, this is the expected behaviour but not what I want. > > > Is there a way I can get the first invalid field and set the focus to > > that? > > > A demo of what I have built up so far can be seen at > >https://webdev2.otago.ac.nz/oihrn2009/ > > > All my jquery validation can be found in > >https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js
[jQuery] Re: Very disappointed with jquery and iframe communication
You can also access the frame's contents via $('#frame_id').contents ().find('xx'), I think. On Sep 15, 9:42 am, Paolo Chiodi wrote: > Of course it doesn't work. > You are searching for node elements with id=login that are child of > your iframes. You need to use the dom of the page loaded inside the i > frame > try $(frames['Theiframe']).get(0).contentDocument > > I in the content page is present jquery, use > $(frames['Theiframe']).get(0).contentWindow.$('#login') > > BTW, you can access child dom only if in same domain > > Paolo > > > > On Tue, Sep 15, 2009 at 10:53 AM, ximo wallas wrote: > > > After 1 day googling and trying I find no agreement in a solid method for > > comunicating with iframe, this is the nearest point I've been to get in > > touch with IFRAME: > > > $(frames['Theiframe']).ready( function () > > { > > alert('Frame is loaded'); > > > }); > > > This will alert the message, but any attempt to comunicate with the iframe > > and access it's contents have been useless, I have a hidden field with with > > ID "login" and I'm trying to get it's value: > > > $(frames['Theiframe']).find("#login").val(); //Doesn't work in FF 3.0.14 > > > /// > > // > > > var $currentIFrame = $(frames['Theiframe']); > > $currentIFrame.contents().find("body #login").val() //Neither does in FF > > 3.0.14 > > > If you Google a few you will see that everyone is giving it's own opinion > > on how to do it, but there's no agreement and no crossbrowser solid > > solution...
[jQuery] Re: SimpleModal 1.3 height
Figured it out myself, so I'm posting for anyone else with this problem. Adding !important to the height specified in my stylesheet overrides the inline style. Not sure if that's the best solution, but it works.
[jQuery] Re: IE 8 chokes on HTML5 elements inserted with jQuery
Regarding #1, he is already doing that (in html5.js). IE fails to parse the new elements in innerHTML even after introducing the new tags via createElement. #2 works fine. If you provide jQuery a single tag then it will use createElement, ex: $('') .append( $('').append( $('Guest') ) .append( $('').append( $('This is the comment') ) ); cheers Ricardo On Sep 15, 9:29 am, Nick Fitzsimons wrote: > 2009/9/15 Perceptes : > > > > > I've encountered a problem with the combination of jQuery, IE, and > > HTML5 elements. HTML5 elements inserted into the page after initial > > load via jQuery's DOM manipulation functions are not parsed correctly > > by IE, even with Remy Sharp's HTML5 shiv script. > > The problem is that jQuery uses innerHTML, rather than DOM methods, to > insert the new content (which is why it's passed to jQuery as a > string). This means it relies on IE's HTML parser to correctly parse > the markup from the string when it is inserted. > > When IE's parser encounters an element it doesn't recognise the name > of, it creates the element as an empty element (similar to or > ), then parses the content as if it were sibling nodes, then > creates an empty element whose name begins with a slash (/ARTICLE for > example); you can see this on your test page by clicking on the "IE > fail" button and then entering: > ame)> > and > me)> > in the location bar; the first will show "ARTICLE", and the second > will show "/ARTICLE". > > To work around this you basically have two options: > > 1. Before any other script is executed, add the line: > document.createElement("article"); > and add equivalent lines for any other HTML5-specific elements you > wish to use (such as section). This prompts IE's HTML parser to expect > blocks with that tagName and it will then parse them correctly. > > 2. Don't use jQuery's innerHTML-dependent approach to creating new > content; instead, use DOM creation methods directly, for example: > > var article = document.createElement("article"); > var header = article.appendChild(document.createElement("header")); > header.appendChild(document.createTextNode("Hello World"); > > var container = document.getElementsByTagName("div")[0]; > container.insertBefore(article, container .getElementsByTagName("h2")[1]); > > ... and so on. (Actually, you can use jQuery for selecting the correct > insertion point and for inserting the new elements there, as jQuery > can cope with elements when inserting content.) > > Regards, > > Nick. > -- > Nick Fitzsimonshttp://www.nickfitz.co.uk/
[jQuery] Re: How to check is element "droppable"
if question isn't clear, I can explain better :) On Sep 15, 7:33 pm, Boris Trivic wrote: > Hi. > > How I can check this? I have next part of code where I must check is > element "tag" = droppable. > > Instead code after "// pseudo:" i must add some function that check if > element is droppable. If true it must write some text in that element > (For example: $(tag).text('bla bla') ) > > // code / > function help(){ > // array generated by PHP: > > // random num. from upper array: > var rand = Math.floor( Math.random() * cor.length ); > // Set tag > if(rand != 0){ > var tag = '#p'+rand; > } > // here goes code that check if "tag" is > droppable... >/// pseudo: >if(tag is droppable){ > alert('is dropable'); >}} > > CODE /
[jQuery] How to check is element "droppable"
Hi. How I can check this? I have next part of code where I must check is element "tag" = droppable. Instead code after "// pseudo:" i must add some function that check if element is droppable. If true it must write some text in that element (For example: $(tag).text('bla bla') ) // code / function help(){ // array generated by PHP: // random num. from upper array: var rand = Math.floor( Math.random() * cor.length ); // Set tag if(rand != 0){ var tag = '#p'+rand; } // here goes code that check if "tag" is droppable... /// pseudo: if(tag is droppable){ alert('is dropable'); } } CODE /
[jQuery] dynamic loading of content from json file: questions about performance and best practices
Hello, I am in the process of creating a slideshow/gallery of 5 'panes', each of which will have some interactive content with hover/click behaviour and hidden/animated sections of content that can be accessed and manipulated. Currently, the gallery is pulling in each 'pane' from a json file. It is randomizing the starting pane though, and I would like to optimize the loading of the json file such that the variable that is being set to determine the starting pane determines which part of the json file is loaded first. Im assuming its pretty easy to load a particular portion of a json file first before the others, though I have yet to try and implement this. I am more interested in best practices/performance boosts in relation to loading the different parts of the json file. I imagine a scenario in which a loading icon is visible until the entirety of each pane is loaded. Does anyone have input as to what I should take into consideration in terms of making sure I am loading the 5 'panes' from the json file in order of appearance on the page and not in the json file? Thanks,
[jQuery] Re: droppable limit
Other solution is to add next code below "...drop: function(){..." $(this).droppable('disable'); logicaly, it will disable drop on element... If you want enable drop, again, add next code below "...out: function (event, ui) {..." $(this).droppable('disable'); Hope it helps... On Sep 8, 3:27 am, "Richard D. Worth" wrote: > The accept option can take a function. That function gets called when a > draggable starts being dragged and the draggable item is sent as the first > argument to the function. So if your droppable already has an item, simply > return false in that function, otherwise return true. The other option would > be to disable or destroy your droppable, once it has an item. > - Richard > > On Sat, Sep 5, 2009 at 10:16 AM, pEeLL wrote: > > > Hi > > > i use for drag and drop this easy code > > > $(function() { > > >$(".ui-draggable").draggable({ revert: 'invalid' }); > > >$(".ui-droppable").droppable({ > >accept: '.ui-draggable', > >drop: function(event, ui) { > >$(this).addClass('red'); > >}, > >out: function(event, ui) { > >$(this).removeClass('red'); > >} > >}); > > }); > > > i have some boxes and some containers. i want add ONLY one box to one > > container. How can i limit number of boxex that will container > > accept? thanks for every help.
[jQuery] Re: Get the onclick method of an element
Damn ... I somehow thought this would be easy to achive . The whole idea was to not change existing code Still .. if anyone has any more ideas :). Somehow it seems that this should be doable. On Tue, Sep 15, 2009 at 6:03 PM, MiKiTiE wrote: > > Ok, I've done some tests and here is my suggestion. > > First of all, should just ask - I assume you are calling it after the > element? Probably is obvious, but thought I'd check. > > Ok, here's the deal: "onclick" is not really an attribute but a mouse > event. Therefore jQuery will take the contents as a function and write > it out as an event. The only alternative is to insert your "DoSomething > (this);" into a standard attribute like "title" or "alt" and then take > it from there. This way you should be able to insert it exactly as its > written and not have it converted into an event. > > Hope this will help? > > On Sep 15, 2:31 pm, sirrocco wrote: > > >Perhaps then you can extract it as text like I mentioned in my first > > > > post, then store it in a variable? > > > > How do I extract it like text ? Calling the .text() method, as > > expected doesn't return what I need - DoSomething(this); > > > > On Sep 15, 3:30 pm,MiKiTiE wrote: > > > > > Perhaps then you can extract it as text like I mentioned in my first > > > post, then store it in a variable? > > > > > As I am not sure what your function does or why it needs to be applied > > > this way, I can't solve the problem exactly - but why not just use an > > > event instead of an onclick in the element? That is what jQuery is > > > there for :-) > > > > > On Sep 15, 9:50 am, sirrocco wrote: > > > > > > Well .. that's the problem - i tried it like that and it didn't work. > > > > > > When setting the attribute back on the link, the this in DoSomething > > > > (this); is not the link, but the window. > > > > > > On Sep 15, 11:41 am,MiKiTiE wrote: > > > > > > > Sorry I should have written > > > > > > > $('a').attr('onclick',onclick); > > > > > > > (setting the attribute value not the inner text!) > > > > > > > On Sep 15, 9:09 am, sirrocco wrote: > > > > > > > > Let's say you have a : > > > > > > > > asd > > > > > > > > I want to get the onclick text in a variable - something like > > > > > > > > var onclick = $('a').attr('onclick'); > > > > > > > > The problem is that the onclick variable now is a function and if > I > > > > > > try to execute , this wil be the document instead of the link . > > > > > > > > How can I get only the text, so I can later reattach it to the > link ? > > >
[jQuery] Re: which submit button was clicked?
$(document).ready(function() { $("#button1, #button2").click(function(event) { event.preventDefault(); alert($(this).attr("id") + " was clicked"); }); });
[jQuery] Re: [validate] custom validation messages
Ah, thanks for the hint, forgot to update that comment. Fixed it now! Jörn On Tue, Sep 15, 2009 at 6:52 PM, Dr Stevens wrote: > > gotcha, figured that out after my last post. > > I actually got here from your last comment on "http://bassistance.de/ > jquery-plugins/jquery-plugin-validation/". I will make note to use > (validate) instead. > > On Sep 15, 12:47 pm, Jörn Zaefferer > wrote: >> I actually changed the plugin page to ask for "(validate)". When you >> use Google Groups in an email client, the subject is displayed just >> fined, while the Web interface removes the prefix. >> >> Jörn >> >> On Tue, Sep 15, 2009 at 6:40 PM, Dr Stevens wrote: >> >> > Sorry for the spam, fixing the subject >> >> > On Sep 15, 12:39 pm, Dr Stevens wrote: >> >> Thanks for your help. You always seem to be very quick to respond and >> >> I, along with everyone else I'm sure, am very appreciative. >> >> >> Great plugin! >> >> >> On Sep 15, 12:35 pm, Jörn Zaefferer >> >> wrote: >> >> >> > You shouldn't use "visible-required" as the method name. Stick with a >> >> > valid JavaScript identifier (probably should have mentioned that). >> >> >> > As long as you do that, you can use addMethod to alias existing >> >> > methods with other default messages. On the other hand, addClassRules >> >> > doesn't help at all with messages. >> >> >> > Jörn >> >> >> > On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens >> >> > wrote: >> >> >> > > I'm using the validate plugin to validate ASP.NET webforms on the >> >> > > client (I'd prefer to not use webforms, but for now I'm stuck with >> >> > > it). Because I'm using webforms, I'm trying to get around using the >> >> > > clientID of server controls. The metadata plugin works great, but I'd >> >> > > prefer to not use it because it's gonna blow up my markup. >> >> >> > > Is there any way to utilize jQuery.validator.addClassRules to add >> >> > > custom messages to a rule? Take the following for instance: >> >> >> > > jQuery.validator.addMethod("visible-required", function(value, >> >> > > element) { >> >> > > return $(element).is(":hidden") || !this.optional(element); >> >> > > }, "This is required when visible"); >> >> >> > > jQuery.validator.addClassRules("fool", { >> >> > > visible-required: true, >> >> > > lettersonly: true, >> >> > > messages: { >> >> > > visible-required: "My specific field must is required", >> >> > > lettersonly: "Letters only fool!" >> >> > > } >> >> > > }); >> >> >> > > On a slightly related note, is there any overhead associated with >> >> > > adding custom validation methods specific to some field only to >> >> > > override the default message? Take the following: >> >> >> > > jQuery.validator.addMethod("visible-required", function(value, >> >> > > element) { >> >> > > return $(element).is(":hidden") || !this.optional(element); >> >> > > }, "This is required when visible"); >> >> >> > > jQuery.validator.addMethod("visible-required-fool", >> >> > > jQuery.validator.methods.visible - required, >> >> > > "My specific field is required"); >> >> >> > > I saw your talk at the conference last weekend btw. Thanks
[jQuery] Re: [validate] custom validation messages
gotcha, figured that out after my last post. I actually got here from your last comment on "http://bassistance.de/ jquery-plugins/jquery-plugin-validation/". I will make note to use (validate) instead. On Sep 15, 12:47 pm, Jörn Zaefferer wrote: > I actually changed the plugin page to ask for "(validate)". When you > use Google Groups in an email client, the subject is displayed just > fined, while the Web interface removes the prefix. > > Jörn > > On Tue, Sep 15, 2009 at 6:40 PM, Dr Stevens wrote: > > > Sorry for the spam, fixing the subject > > > On Sep 15, 12:39 pm, Dr Stevens wrote: > >> Thanks for your help. You always seem to be very quick to respond and > >> I, along with everyone else I'm sure, am very appreciative. > > >> Great plugin! > > >> On Sep 15, 12:35 pm, Jörn Zaefferer > >> wrote: > > >> > You shouldn't use "visible-required" as the method name. Stick with a > >> > valid JavaScript identifier (probably should have mentioned that). > > >> > As long as you do that, you can use addMethod to alias existing > >> > methods with other default messages. On the other hand, addClassRules > >> > doesn't help at all with messages. > > >> > Jörn > > >> > On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens > >> > wrote: > > >> > > I'm using the validate plugin to validate ASP.NET webforms on the > >> > > client (I'd prefer to not use webforms, but for now I'm stuck with > >> > > it). Because I'm using webforms, I'm trying to get around using the > >> > > clientID of server controls. The metadata plugin works great, but I'd > >> > > prefer to not use it because it's gonna blow up my markup. > > >> > > Is there any way to utilize jQuery.validator.addClassRules to add > >> > > custom messages to a rule? Take the following for instance: > > >> > > jQuery.validator.addMethod("visible-required", function(value, > >> > > element) { > >> > > return $(element).is(":hidden") || !this.optional(element); > >> > > }, "This is required when visible"); > > >> > > jQuery.validator.addClassRules("fool", { > >> > > visible-required: true, > >> > > lettersonly: true, > >> > > messages: { > >> > > visible-required: "My specific field must is required", > >> > > lettersonly: "Letters only fool!" > >> > > } > >> > > }); > > >> > > On a slightly related note, is there any overhead associated with > >> > > adding custom validation methods specific to some field only to > >> > > override the default message? Take the following: > > >> > > jQuery.validator.addMethod("visible-required", function(value, > >> > > element) { > >> > > return $(element).is(":hidden") || !this.optional(element); > >> > > }, "This is required when visible"); > > >> > > jQuery.validator.addMethod("visible-required-fool", > >> > > jQuery.validator.methods.visible - required, > >> > > "My specific field is required"); > > >> > > I saw your talk at the conference last weekend btw. Thanks
[jQuery] Re: [validate] custom validation messages
I actually changed the plugin page to ask for "(validate)". When you use Google Groups in an email client, the subject is displayed just fined, while the Web interface removes the prefix. Jörn On Tue, Sep 15, 2009 at 6:40 PM, Dr Stevens wrote: > > Sorry for the spam, fixing the subject > > On Sep 15, 12:39 pm, Dr Stevens wrote: >> Thanks for your help. You always seem to be very quick to respond and >> I, along with everyone else I'm sure, am very appreciative. >> >> Great plugin! >> >> On Sep 15, 12:35 pm, Jörn Zaefferer >> wrote: >> >> > You shouldn't use "visible-required" as the method name. Stick with a >> > valid JavaScript identifier (probably should have mentioned that). >> >> > As long as you do that, you can use addMethod to alias existing >> > methods with other default messages. On the other hand, addClassRules >> > doesn't help at all with messages. >> >> > Jörn >> >> > On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens wrote: >> >> > > I'm using the validate plugin to validate ASP.NET webforms on the >> > > client (I'd prefer to not use webforms, but for now I'm stuck with >> > > it). Because I'm using webforms, I'm trying to get around using the >> > > clientID of server controls. The metadata plugin works great, but I'd >> > > prefer to not use it because it's gonna blow up my markup. >> >> > > Is there any way to utilize jQuery.validator.addClassRules to add >> > > custom messages to a rule? Take the following for instance: >> >> > > jQuery.validator.addMethod("visible-required", function(value, >> > > element) { >> > > return $(element).is(":hidden") || !this.optional(element); >> > > }, "This is required when visible"); >> >> > > jQuery.validator.addClassRules("fool", { >> > > visible-required: true, >> > > lettersonly: true, >> > > messages: { >> > > visible-required: "My specific field must is required", >> > > lettersonly: "Letters only fool!" >> > > } >> > > }); >> >> > > On a slightly related note, is there any overhead associated with >> > > adding custom validation methods specific to some field only to >> > > override the default message? Take the following: >> >> > > jQuery.validator.addMethod("visible-required", function(value, >> > > element) { >> > > return $(element).is(":hidden") || !this.optional(element); >> > > }, "This is required when visible"); >> >> > > jQuery.validator.addMethod("visible-required-fool", >> > > jQuery.validator.methods.visible - required, >> > > "My specific field is required"); >> >> > > I saw your talk at the conference last weekend btw. Thanks
[jQuery] Re: [validate] custom validation messages
You shouldn't use "visible-required" as the method name. Stick with a valid JavaScript identifier (probably should have mentioned that). As long as you do that, you can use addMethod to alias existing methods with other default messages. On the other hand, addClassRules doesn't help at all with messages. Jörn On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens wrote: > > I'm using the validate plugin to validate ASP.NET webforms on the > client (I'd prefer to not use webforms, but for now I'm stuck with > it). Because I'm using webforms, I'm trying to get around using the > clientID of server controls. The metadata plugin works great, but I'd > prefer to not use it because it's gonna blow up my markup. > > Is there any way to utilize jQuery.validator.addClassRules to add > custom messages to a rule? Take the following for instance: > > jQuery.validator.addMethod("visible-required", function(value, > element) { > return $(element).is(":hidden") || !this.optional(element); > }, "This is required when visible"); > > jQuery.validator.addClassRules("fool", { > visible-required: true, > lettersonly: true, > messages: { > visible-required: "My specific field must is required", > lettersonly: "Letters only fool!" > } > }); > > On a slightly related note, is there any overhead associated with > adding custom validation methods specific to some field only to > override the default message? Take the following: > > jQuery.validator.addMethod("visible-required", function(value, > element) { > return $(element).is(":hidden") || !this.optional(element); > }, "This is required when visible"); > > jQuery.validator.addMethod("visible-required-fool", > jQuery.validator.methods.visible - required, > "My specific field is required"); > > I saw your talk at the conference last weekend btw. Thanks >
[jQuery] Re: [validate] custom validation messages
Sorry for the spam, fixing the subject On Sep 15, 12:39 pm, Dr Stevens wrote: > Thanks for your help. You always seem to be very quick to respond and > I, along with everyone else I'm sure, am very appreciative. > > Great plugin! > > On Sep 15, 12:35 pm, Jörn Zaefferer > wrote: > > > You shouldn't use "visible-required" as the method name. Stick with a > > valid JavaScript identifier (probably should have mentioned that). > > > As long as you do that, you can use addMethod to alias existing > > methods with other default messages. On the other hand, addClassRules > > doesn't help at all with messages. > > > Jörn > > > On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens wrote: > > > > I'm using the validate plugin to validate ASP.NET webforms on the > > > client (I'd prefer to not use webforms, but for now I'm stuck with > > > it). Because I'm using webforms, I'm trying to get around using the > > > clientID of server controls. The metadata plugin works great, but I'd > > > prefer to not use it because it's gonna blow up my markup. > > > > Is there any way to utilize jQuery.validator.addClassRules to add > > > custom messages to a rule? Take the following for instance: > > > > jQuery.validator.addMethod("visible-required", function(value, > > > element) { > > > return $(element).is(":hidden") || !this.optional(element); > > > }, "This is required when visible"); > > > > jQuery.validator.addClassRules("fool", { > > > visible-required: true, > > > lettersonly: true, > > > messages: { > > > visible-required: "My specific field must is required", > > > lettersonly: "Letters only fool!" > > > } > > > }); > > > > On a slightly related note, is there any overhead associated with > > > adding custom validation methods specific to some field only to > > > override the default message? Take the following: > > > > jQuery.validator.addMethod("visible-required", function(value, > > > element) { > > > return $(element).is(":hidden") || !this.optional(element); > > > }, "This is required when visible"); > > > > jQuery.validator.addMethod("visible-required-fool", > > > jQuery.validator.methods.visible - required, > > > "My specific field is required"); > > > > I saw your talk at the conference last weekend btw. Thanks
[jQuery] Re: [validate] custom validation messages
Thanks for your help. You always seem to be very quick to respond and I, along with everyone else I'm sure, am very appreciative. Great plugin! On Sep 15, 12:35 pm, Jörn Zaefferer wrote: > You shouldn't use "visible-required" as the method name. Stick with a > valid JavaScript identifier (probably should have mentioned that). > > As long as you do that, you can use addMethod to alias existing > methods with other default messages. On the other hand, addClassRules > doesn't help at all with messages. > > Jörn > > On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens wrote: > > > I'm using the validate plugin to validate ASP.NET webforms on the > > client (I'd prefer to not use webforms, but for now I'm stuck with > > it). Because I'm using webforms, I'm trying to get around using the > > clientID of server controls. The metadata plugin works great, but I'd > > prefer to not use it because it's gonna blow up my markup. > > > Is there any way to utilize jQuery.validator.addClassRules to add > > custom messages to a rule? Take the following for instance: > > > jQuery.validator.addMethod("visible-required", function(value, > > element) { > > return $(element).is(":hidden") || !this.optional(element); > > }, "This is required when visible"); > > > jQuery.validator.addClassRules("fool", { > > visible-required: true, > > lettersonly: true, > > messages: { > > visible-required: "My specific field must is required", > > lettersonly: "Letters only fool!" > > } > > }); > > > On a slightly related note, is there any overhead associated with > > adding custom validation methods specific to some field only to > > override the default message? Take the following: > > > jQuery.validator.addMethod("visible-required", function(value, > > element) { > > return $(element).is(":hidden") || !this.optional(element); > > }, "This is required when visible"); > > > jQuery.validator.addMethod("visible-required-fool", > > jQuery.validator.methods.visible - required, > > "My specific field is required"); > > > I saw your talk at the conference last weekend btw. Thanks
[jQuery] Re: custom validation messages
Hrmm, Jörn's blog comments said to use [validate] in the subject, but it looks like that got removed. There was a bug in the code at the end of my post. Use this instead jQuery.validator.addMethod("visibleRequired", function(value, element) { return $(element).is(":hidden") || !this.optional(element); }, "This is required when visible"); jQuery.validator.addMethod("visibleRequiredFool", jQuery.validator.methods.visibleRequired, "My specific field is required"); On Sep 15, 11:32 am, Dr Stevens wrote: > I'm using the validate plugin to validate ASP.NET webforms on the > client (I'd prefer to not use webforms, but for now I'm stuck with > it). Because I'm using webforms, I'm trying to get around using the > clientID of server controls. The metadata plugin works great, but I'd > prefer to not use it because it's gonna blow up my markup. > > Is there any way to utilize jQuery.validator.addClassRules to add > custom messages to a rule? Take the following for instance: > > jQuery.validator.addMethod("visible-required", function(value, > element) { > return $(element).is(":hidden") || !this.optional(element); > > }, "This is required when visible"); > > jQuery.validator.addClassRules("fool", { > visible-required: true, > lettersonly: true, > messages: { > visible-required: "My specific field must is required", > lettersonly: "Letters only fool!" > } > > }); > > On a slightly related note, is there any overhead associated with > adding custom validation methods specific to some field only to > override the default message? Take the following: > > jQuery.validator.addMethod("visible-required", function(value, > element) { > return $(element).is(":hidden") || !this.optional(element); > > }, "This is required when visible"); > > jQuery.validator.addMethod("visible-required-fool", > jQuery.validator.methods.visible - required, > "My specific field is required"); > > I saw your talk at the conference last weekend btw. Thanks
[jQuery] Using jQuery and Prototype in parallel: breaks in Safari version 2 and 3 on a Mac?
Hi, I am using the Prototype/Scriptaculous and jQuery frameworks in parallel on my website. I'm slowly migrating to jQuery but need to use both in the meantime. This doesn't appear to cause any problems in any version of Internet Explorer > 6.0 or Firefox on a PC. However, all javascript seems to break in versions 2 and 3 of Safari on a Mac. I have tested this using versions of Safari taken from this website http://michelf.com/projects/multi-safari/ and Macs with old versions of Safari installed on them. Is this a problem you guys are familiar with and if so is there an easy solution? Thanks
[jQuery] Access to restricted URI denied
I am trying to load a js file on a twisted server. The html file is created by a Python script. The first javascript is loaded. A second script is load in the first. I get "Access to restricted URI denied" when loading the second script. Trying to get jsMath to function on the server. Any help would be greatly appreciated.
[jQuery] [validate] custom validation messages
I'm using the validate plugin to validate ASP.NET webforms on the client (I'd prefer to not use webforms, but for now I'm stuck with it). Because I'm using webforms, I'm trying to get around using the clientID of server controls. The metadata plugin works great, but I'd prefer to not use it because it's gonna blow up my markup. Is there any way to utilize jQuery.validator.addClassRules to add custom messages to a rule? Take the following for instance: jQuery.validator.addMethod("visible-required", function(value, element) { return $(element).is(":hidden") || !this.optional(element); }, "This is required when visible"); jQuery.validator.addClassRules("fool", { visible-required: true, lettersonly: true, messages: { visible-required: "My specific field must is required", lettersonly: "Letters only fool!" } }); On a slightly related note, is there any overhead associated with adding custom validation methods specific to some field only to override the default message? Take the following: jQuery.validator.addMethod("visible-required", function(value, element) { return $(element).is(":hidden") || !this.optional(element); }, "This is required when visible"); jQuery.validator.addMethod("visible-required-fool", jQuery.validator.methods.visible - required, "My specific field is required"); I saw your talk at the conference last weekend btw. Thanks
[jQuery] SimpleModal 1.3 height
Since upgrading to SimpleModal 1.3 from 1.2.3, I'm having real trouble with the height of the container. Something somewhere keeps inserting a height of 84px inline into the container div. Because it's inline I can't override it with my stylesheets -- the inline styles override the stylesheet. - I tried setting the minHeight and maxHeight params, but those don't help. - I tried setting the containerCSS with height of 'auto' or 'inherit', but that doesn't work. - If I set the containerCss with a height set to a pixel value, it does override the 84px inline style ... but I don't want a hardcoded pixel height. The content inside the container is of variable height, so I need the container to expand to accommodate the height of the content. I was using 1.2.3 for the last year or so with no problems, and nothing in my code changed. The issue began immediately after upgrading to 1.3, so that must be the source of the problem. Any thoughts?
[jQuery] Help with error script
I have an ajax function that checks fields to validate and display error messages. There are multiple messages depending on the error per field in some cases, to short, to long, already taken, invalid, cant be empty and so onyou get the idea. My function is like this: function(error) { if(error.length != 0) { if ( $('#' + fieldName + '-exists').length == 0 ) { $('#' + fieldName).after('' + error + ''); } } else { $('#' + fieldName + '-exists').remove(); } }); But the error never changes once 1 is called so if to short it says too shortfix the problem and it only shows too short never any other message. How can i remove the message if its fixed but still return anothererror if it exists? I tried if ( $('#' + fieldName + '-exists').length != error ) so if the error is different display the error but it doesnot remove the original error Ideas? Thanks Dave
[jQuery] [RELEASE] Karma 0.1 , jquery plugin and examples for manipulating html5 audio, image, canvas elements
We are proud to release Karma version 0.1 today. Please download the code and try it out for yourself. You can also test out the demo here. You need Firefox 3.5 to run the demo. The core of Karma is a jQuery plugin for manipulating html5 audio, image, canvas elements. Source Code: http://karma.sugarlabs.org/karma-0.1.tar.gz Features: * Chaining of operations * Wrappers for drawing functions * API documentation * simple mechanism for pre-loading images and audio Known Bugs: * You cannot access the Adding_Up lesson from google chrome or chromium. It does work if you have the lesson stored on your local machine. This is because chromium does not yet support loading media over HTTP. * Knavbar with adding up. * The links on ‘kstart’ page to Teacher’s Note and Lesson Note don’t go anywhere * The css on stages 2 and 3 of Chakra are all screwed up Features that didn’t make it into Release 0.1: * Internationalization mechanism * SVG manipulation * Addition of knavbar to adding_up_to_10 * A refactored version of the Quadrilaterals lesson Contributors: * Bryan Berry * Felipe Lopez Toledo * Christoph Derndorfer * Om Prakash Yadav * Rabi Karmacharya * Roshan Karki * Saurav Dev Bhatta * Devendra Khadka * Pavel Mocan Please test out Chakra and our first lesson “Adding up.” We would most appreciate it if you report any bugs you find to our bugtracker on launchpad -- Bryan W. Berry Technology Director OLE Nepal, http://www.olenepal.org
[jQuery] Re: Very disappointed with jquery and iframe communication
this should work: $(frames['Theiframe']).attr('src', new_page_url); On Tue, Sep 15, 2009 at 4:45 PM, ximo wallas wrote: > > How can I tell to the iframe to load() a different content from the main > document? > > --- On Tue, 9/15/09, Paolo Chiodi wrote: > > From: Paolo Chiodi > Subject: [jQuery] Re: Very disappointed with jquery and iframe communication > To: jquery-en@googlegroups.com > Date: Tuesday, September 15, 2009, 1:42 PM > > > Of course it doesn't work. > You are searching for node elements with id=login that are child of > your iframes. You need to use the dom of the page loaded inside the i > frame > try $(frames['Theiframe']).get(0).contentDocument > > I in the content page is present jquery, use > $(frames['Theiframe']).get(0).contentWindow.$('#login') > > BTW, you can access child dom only if in same domain > > Paolo > > On Tue, Sep 15, 2009 at 10:53 AM, ximo wallas wrote: > > > > After 1 day googling and trying I find no agreement in a solid method for > > comunicating with iframe, this is the nearest point I've been to get in > > touch with IFRAME: > > > > $(frames['Theiframe']).ready( function () > > { > > alert('Frame is loaded'); > > > > }); > > > > This will alert the message, but any attempt to comunicate with the iframe > > and access it's contents have been useless, I have a hidden field with with > > ID "login" and I'm trying to get it's value: > > > > $(frames['Theiframe']).find("#login").val(); //Doesn't work in FF 3.0.14 > > > > / > > > > var $currentIFrame = $(frames['Theiframe']); > > $currentIFrame.contents().find("body #login").val() //Neither does in FF > > 3.0.14 > > > > If you Google a few you will see that everyone is giving it's own opinion > > on how to do it, but there's no agreement and no crossbrowser solid > > solution... > > > > >
[jQuery] Re: error in ie7 & ie8 only
narrowed down but not solved this causes error in ie $('.body').block({ message: '', css: { border: '1px solid #FFF; background: #FFF;' }}) yet this works $('.body').block({ message: 'Processing', css: { border: '3px solid #a00' } }); so bit of further investigation and I now understand it css: { border: '1px solid #FFF; background: #FFF;' } needed to be (no semi colons and make the css setting a JSON object - ff et al are more forgiving) css: { border: '1px solid #FFF', background: '#FFF' } - S 2009/9/15 Sam Sherlock > seems this may be relevant [1] but I can't find where I can parseInt - > might be a plugin that is causing the issue > > I am using blockui - I thought that noticing that blockui uses this sz() > which parses the int - maybe I need to make another plugin use sz() > > this results from the following > $('.tabs a, a.groove').live('click', function(event, args) { > jLinkCall(event, args, this); > event.preventDefault(); > event.stopPropagation(); > return false; > }); > > [1] > http://stackoverflow.com/questions/933564/jquery-widthval-error-in-ie-invalid-argument > > - S > > > 2009/9/15 Sam Sherlock > >> following up on that when debugging I can continue through the error and >> it works as expected. but with debugging off the process is interrupted >> - S >> >> >> 2009/9/15 Sam Sherlock >> >> js code: >>> function jLinkCall(e, a, o) { >>> var jUrl = null, jArgs = null, obTitle = ''; >>> // console.info('jLinkCall'); >>> // console.info(e); >>> // console.info(a); >>> // console.info($(o).attr('href')); >>> >>> jUrl = $(o).attr('href') + ''; >>> jUrl = jUrl.replace(/.html/, ''); >>> >>> if($(o).attr('title')) >>> obTitle = $(o).attr('title'); >>> >>> // block with growl >>> //$('#body').growlUI('Growl Notification', 'Have a nice day!'); >>> $('.body').block({ >>> message: '', >>> css: { border: '1px solid #FFF; background: #FFF;' }}) >>> $.post('./json.php?p='+jUrl, null, jLinkComplete, "json") >>> >>> // convert the html url to json url >>> // process the json object >>> // oncomplete call jLinkComplete >>> >>> } >>> >>> function jLinkComplete(data, status) { >>> // console.info('jLinkComplete'); >>> // console.info(data.titleStr); >>> // console.info(status); >>> $('body').attr('class', '').addClass(data.titleStr); >>> $('.body').empty().html(data.contentStr).unblock(); >>> init(); >>> } >>> >>> set up in dom ready >>> $('.tabs a').live('click', function(event, args) { >>> jLinkCall(event, args, this); >>> event.preventDefault(); >>> event.stopPropagation(); >>> return false; >>> }); >>> >>> This is an issue that only is apparent in ie7 & 8 all works without >>> issue in other browsers - not ie 6 though (but who cares) any ideas? >>> >>> >>> - S >>> >> >> >
[jQuery] Re: Show/Hide
I have figured this out, I replaced $('#add_link').click(function(){ $(this).parent().next('div').show('slow'); }); $('#remove_link').click(function(){ $(this).parent().hide('slow'); }); with $('a[id=add_link]').click(function(){ $(this).parent().next('div').show('slow'); }); $('a[id=remove_link]').click(function(){ $(this).parent().hide('slow'); }); On Sep 15, 8:44 am, Richard Walsh wrote: > I am working on a toolset that shows/hides divs. The divs are named > id-1 to id-6. > > > content > > > content > > > And so on. The script I have written is below: > > > $(function(){ > $('#id-2').hide(); > $('#id-3').hide(); > $('#id-4').hide(); > $('#id-5').hide(); > $('#id-6').hide(); > $('#add_link').click(function(){ > $(this).parent().next('div').show('slow'); > }); > $('#remove_link').click(function(){ > $(this).parent().hide('slow'); > }); > }); > > > The beginning part basically just hides div 2-6 on load. The next part > with "#add_link" that adds the next div if needed, and then the last, > removes the current div. This all works, but only on first set. > > So basically I have a repeated piece; as below: > > > Identifer 1 > > - Please Select - > Sec > Row > Seat > Ticket Barcode > RecID > Book No. > Account No. > Other > > > Add > > > This occurs 6 times, starting on I add another link > for removing that div. > > As I said above, they first set works, but after that it doesn't. How > can I get this working so that it works for all 6. I want to try and > avoid writing a function for all six, as in the future I may have to > add in more items.
[jQuery] Selectbox
I remember seeing a sample somewhere, now for the life of me when I actually need to use it. I can't remember how or where I found it. I am hoping someone can shed some light. What I want to achieve, is when a value is picked in a select box, an empty input field appears after a value is selected. If someone can point me in the right direction it would be great! Thanks
[jQuery] how to expand a node dynamicly in treeview plugin
For example I have a treeview control and there are 500 items . I have also a search box control. When I type one of item of treeview on searchbox, I want to find typed item , focus it and expand it dynamicly. Is it possible? if is it, how can i do.. Thanks
[jQuery] Re: Selectbox
Actually found what I was looking for, it is here. http://blog.kotowicz.net/2009/03/jquery-optiontree-demo.html Thanks On Sep 15, 8:50 am, Richard Walsh wrote: > I remember seeing a sample somewhere, now for the life of me when I > actually need to use it. I can't remember how or where I found it. I > am hoping someone can shed some light. > > What I want to achieve, is when a value is picked in a select box, an > empty input field appears after a value is selected. If someone can > point me in the right direction it would be great! > > Thanks
[jQuery] Re: Very disappointed with jquery and iframe communication
How can I tell to the iframe to load() a different content from the main document? --- On Tue, 9/15/09, Paolo Chiodi wrote: From: Paolo Chiodi Subject: [jQuery] Re: Very disappointed with jquery and iframe communication To: jquery-en@googlegroups.com Date: Tuesday, September 15, 2009, 1:42 PM Of course it doesn't work. You are searching for node elements with id=login that are child of your iframes. You need to use the dom of the page loaded inside the i frame try $(frames['Theiframe']).get(0).contentDocument I in the content page is present jquery, use $(frames['Theiframe']).get(0).contentWindow.$('#login') BTW, you can access child dom only if in same domain Paolo On Tue, Sep 15, 2009 at 10:53 AM, ximo wallas wrote: > > After 1 day googling and trying I find no agreement in a solid method for > comunicating with iframe, this is the nearest point I've been to get in touch > with IFRAME: > > $(frames['Theiframe']).ready( function () > { > alert('Frame is loaded'); > > }); > > This will alert the message, but any attempt to comunicate with the iframe > and access it's contents have been useless, I have a hidden field with with > ID "login" and I'm trying to get it's value: > > $(frames['Theiframe']).find("#login").val(); //Doesn't work in FF 3.0.14 > > / > > var $currentIFrame = $(frames['Theiframe']); > $currentIFrame.contents().find("body #login").val() //Neither does in FF > 3.0.14 > > If you Google a few you will see that everyone is giving it's own opinion on > how to do it, but there's no agreement and no crossbrowser solid solution... > >
[jQuery] Re: Easy show()/hide() Question
Thanks for the note, I'll give that a try. Cheers - george On Sep 15, 10:19 am, Steven Black wrote: > The problem is synchronicity. When you add an animation (like "slow" > or "fast") the animation process starts but, behind the scenes, > subsequent lines of javascript continue to execute during the > animation. > > When you need things in strict order, and you have an animation, use > the callback, which will fire once the animation is complete. > > In other words, use show(speed, callback) and hide(speed, callback). > > **--** Steve > > On Sep 10, 10:18 am, GLSmyth wrote: > > > I am missing something fundamental and am sure that someone can point > > me in the right direction. > > > I have a list like so: > > > DD > > > > Santuary > > Stream > > Winter > > > > > > > I have styled it so that the list items float. The class DoNotDisplay > > hides the unordered list. When the mouse hovers over GalleryMenu then > > jQuery removes the DoNotDisplay class so that the unordered list is > > displayed, moving off GalleryMenu hides the list. This works fine and > > the code is: > > > $(document).ready( > > function() { > > $('li#GalleryMenu').add('li#PoemMenu').hover( > > function() { > > $(this).children('ul').removeClass('DoNotDisplay'); > > }, > > function() { > > $(this).children('ul').addClass('DoNotDisplay'); > > } > > ); > > } > > ); > > > I would like the unordered list to slide open, so I changed the code > > to: > > > $(document).ready( > > function() { > > $('li#GalleryMenu').add('li#PoemMenu').hover( > > function() { > > $(this).children('ul').show('fast'); > > console.log('Open list'); > > }, > > function() { > > $(this).children('ul').hide('fast'); > > console.log('Close list'); > > } > > ); > > } > > ); > > > The list opens properly, but does not close when I move the mouse from > > the list. When looking at this in Firebug I see that 'hide' is > > firing, but for some reason does not close the list. If I "unfloat" > > the list then the code works just fine. > > > What am I missing? I'm sure that it is staring me in the face, but I > > am just not seeing it. The full code can be found > > athttp://glsmyth.com/Sedwick/Templates/ > > > Thanks for looking. > > > Cheers - > > > george
[jQuery] Re: Get the onclick method of an element
Ok, I've done some tests and here is my suggestion. First of all, should just ask - I assume you are calling it after the element? Probably is obvious, but thought I'd check. Ok, here's the deal: "onclick" is not really an attribute but a mouse event. Therefore jQuery will take the contents as a function and write it out as an event. The only alternative is to insert your "DoSomething (this);" into a standard attribute like "title" or "alt" and then take it from there. This way you should be able to insert it exactly as its written and not have it converted into an event. Hope this will help? On Sep 15, 2:31 pm, sirrocco wrote: > >Perhaps then you can extract it as text like I mentioned in my first > > post, then store it in a variable? > > How do I extract it like text ? Calling the .text() method, as > expected doesn't return what I need - DoSomething(this); > > On Sep 15, 3:30 pm,MiKiTiE wrote: > > > Perhaps then you can extract it as text like I mentioned in my first > > post, then store it in a variable? > > > As I am not sure what your function does or why it needs to be applied > > this way, I can't solve the problem exactly - but why not just use an > > event instead of an onclick in the element? That is what jQuery is > > there for :-) > > > On Sep 15, 9:50 am, sirrocco wrote: > > > > Well .. that's the problem - i tried it like that and it didn't work. > > > > When setting the attribute back on the link, the this in DoSomething > > > (this); is not the link, but the window. > > > > On Sep 15, 11:41 am,MiKiTiE wrote: > > > > > Sorry I should have written > > > > > $('a').attr('onclick',onclick); > > > > > (setting the attribute value not the inner text!) > > > > > On Sep 15, 9:09 am, sirrocco wrote: > > > > > > Let's say you have a : > > > > > > asd > > > > > > I want to get the onclick text in a variable - something like > > > > > > var onclick = $('a').attr('onclick'); > > > > > > The problem is that the onclick variable now is a function and if I > > > > > try to execute , this wil be the document instead of the link . > > > > > > How can I get only the text, so I can later reattach it to the link ?
[jQuery] Show/Hide
I am working on a toolset that shows/hides divs. The divs are named id-1 to id-6. content content And so on. The script I have written is below: $(function(){ $('#id-2').hide(); $('#id-3').hide(); $('#id-4').hide(); $('#id-5').hide(); $('#id-6').hide(); $('#add_link').click(function(){ $(this).parent().next('div').show('slow'); }); $('#remove_link').click(function(){ $(this).parent().hide('slow'); }); }); The beginning part basically just hides div 2-6 on load. The next part with "#add_link" that adds the next div if needed, and then the last, removes the current div. This all works, but only on first set. So basically I have a repeated piece; as below: Identifer 1 - Please Select - Sec Row Seat Ticket Barcode RecID Book No. Account No. Other Add This occurs 6 times, starting on I add another link for removing that div. As I said above, they first set works, but after that it doesn't. How can I get this working so that it works for all 6. I want to try and avoid writing a function for all six, as in the future I may have to add in more items.
[jQuery] Re: saving values from a multi select list.
With Pleasure. === first post Im using a plugin called selectchain by Remy Sharp and modified it a bit. Right now im trying to pass only selected values of a multi select list through ajax. The following function does a bit more but im concerned with the part that says cust_val: customer.val().join(",") This should return only selected values. This is what happens if i put it in an alert(). however when i check firebug to see what was posted it shows the entire list. I've tried alternatives like option:selected they all work for alet() .. but the info passed through ajax shows the entire list. please help. customer.selectChain({ target: market, url: callback_url, type: "POST", data: { ajax: true, multsel: market_selects, cust_val: customer.val ().join(",") } }).trigger('change'); = Second Post = Ok so i thought that maybe the problem had something to do with the ajax request so i tried adding the ajaxStart function. See below. $("#ddl_customer").change(function(){ $("#ddl_customer").ajaxStart(function() { cuslist = $(this).val().join(", "); }); alert(cuslist); }); $("#ddl_customer").selectChain({ target: market, url: callback_url, type: "POST", data: { ajax: true, multsel: market_selects, cust_val: cuslist } }).trigger('change'); So im trying to get all the selected values from ddl_customer in the first block of code. then pass it to cust_val in the second block of code. note that the alert(custlist) outputs what i expect. but when i check cust_val in firebug it outputs the entire list, not only selected values. Please Help!:(
[jQuery] Re: saving values from a multi select list.
I don't have the original message in my email any longer. Can you post the code involved? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of shaded Sent: Tuesday, September 15, 2009 9:42 AM To: jQuery (English) Subject: [jQuery] Re: saving values from a multi select list. Still stuck on this.no one has even a suggestion as to what maybe wrong?
[jQuery] Re: Very disappointed with jquery and iframe communication
It is firing the alert, you think it is not? How can I access it and have some control over?
[jQuery] Re: Easy show()/hide() Question
The problem is synchronicity. When you add an animation (like "slow" or "fast") the animation process starts but, behind the scenes, subsequent lines of javascript continue to execute during the animation. When you need things in strict order, and you have an animation, use the callback, which will fire once the animation is complete. In other words, use show(speed, callback) and hide(speed, callback). **--** Steve On Sep 10, 10:18 am, GLSmyth wrote: > I am missing something fundamental and am sure that someone can point > me in the right direction. > > I have a list like so: > > DD > > Santuary > Stream > Winter > > > > I have styled it so that the list items float. The class DoNotDisplay > hides the unordered list. When the mouse hovers over GalleryMenu then > jQuery removes the DoNotDisplay class so that the unordered list is > displayed, moving off GalleryMenu hides the list. This works fine and > the code is: > > $(document).ready( > function() { > $('li#GalleryMenu').add('li#PoemMenu').hover( > function() { > $(this).children('ul').removeClass('DoNotDisplay'); > }, > function() { > $(this).children('ul').addClass('DoNotDisplay'); > } > ); > } > ); > > I would like the unordered list to slide open, so I changed the code > to: > > $(document).ready( > function() { > $('li#GalleryMenu').add('li#PoemMenu').hover( > function() { > $(this).children('ul').show('fast'); > console.log('Open list'); > }, > function() { > $(this).children('ul').hide('fast'); > console.log('Close list'); > } > ); > } > ); > > The list opens properly, but does not close when I move the mouse from > the list. When looking at this in Firebug I see that 'hide' is > firing, but for some reason does not close the list. If I "unfloat" > the list then the code works just fine. > > What am I missing? I'm sure that it is staring me in the face, but I > am just not seeing it. The full code can be found > athttp://glsmyth.com/Sedwick/Templates/ > > Thanks for looking. > > Cheers - > > george
[jQuery] Re: Simple/short way to bind one event to multiple objects?
The change event handler can also be passed by reference, avoiding the need for the closures ("#obj1,#obj2,#obj3").change( setupPage ); On Sep 15, 7:40 am, Mr Speaker wrote: > you can select multiple objects in the selector, like: $ > ("#obj1,#obj2,#obj3").change(...) > > On Sep 15, 7:42 am, cgp wrote: > > > I have 2 or more objects that onclick(), will call the same function. > > Right now I have the following: > > > > > $("#obj1").change( function() { > > setupPage();}); > > > $("#obj2").change( function() { > > setupPage();}); > > > $("#obj3").change( function() { > > setupPage();}); > > > > > > I was wondering if there is a way to simplify or clean up the code, > > since they are all doing the same thing and responding to the same > > event. This is just for refactoring reasons because my code is getting > > too long/messy. > > > Thanks.
[jQuery] Re: saving values from a multi select list.
Still stuck on this.no one has even a suggestion as to what maybe wrong?
[jQuery] Re: content containing JS retrieved via AJAX crashes browser
After doing a bit more research, I've tried using live() and load(), both with no further advancement. Can anyone help shed some light on this problem? Please?!? --Mitch
[jQuery] Re: Get the onclick method of an element
>Perhaps then you can extract it as text like I mentioned in my first post, then store it in a variable? How do I extract it like text ? Calling the .text() method, as expected doesn't return what I need - DoSomething(this); On Sep 15, 3:30 pm, MiKiTiE wrote: > Perhaps then you can extract it as text like I mentioned in my first > post, then store it in a variable? > > As I am not sure what your function does or why it needs to be applied > this way, I can't solve the problem exactly - but why not just use an > event instead of an onclick in the element? That is what jQuery is > there for :-) > > On Sep 15, 9:50 am, sirrocco wrote: > > > Well .. that's the problem - i tried it like that and it didn't work. > > > When setting the attribute back on the link, the this in DoSomething > > (this); is not the link, but the window. > > > On Sep 15, 11:41 am,MiKiTiE wrote: > > > > Sorry I should have written > > > > $('a').attr('onclick',onclick); > > > > (setting the attribute value not the inner text!) > > > > On Sep 15, 9:09 am, sirrocco wrote: > > > > > Let's say you have a : > > > > > asd > > > > > I want to get the onclick text in a variable - something like > > > > > var onclick = $('a').attr('onclick'); > > > > > The problem is that the onclick variable now is a function and if I > > > > try to execute , this wil be the document instead of the link . > > > > > How can I get only the text, so I can later reattach it to the link ? > >
[jQuery] Re: Jquery gradient and tabs
Ah, since I am not familiar with this implementation of tabs (only the jQuery built in one) I'm not sure I know the answer, sorry. Have you contacted the creator of those tabs? On Sep 15, 1:38 pm, Anush Shetty wrote: > On Tue, Sep 15, 2009 at 5:55 PM,MiKiTiE wrote: > > > Having checked the source code, it looks like you're not even > > including the core and tabs ui. > > > For example: > > > http://jqueryui.com/latest/ui/ > > ui.core.js"> > > http://jqueryui.com/latest/ui/ > > ui.tabs.js"> > > > If you were to link direct to jquery. That may be why your tabs are > > not working properly. > > No, its not that. I am using this technique > > http://blueprintcss.org/demos/tabs.html > > This doesn't need ui.core.js and ui.tabs.js > > - > Anush
[jQuery] Re: trim string
You could easily just do the following: cat=["com12", "com1", "cop233", "com1.1", "sap-12-1"]; cat = $.map(cat, function(a){ return a.replace(/[\d\.\-]/g, ""); }); Good Luck!
[jQuery] Re: Very disappointed with jquery and iframe communication
Of course it doesn't work. You are searching for node elements with id=login that are child of your iframes. You need to use the dom of the page loaded inside the i frame try $(frames['Theiframe']).get(0).contentDocument I in the content page is present jquery, use $(frames['Theiframe']).get(0).contentWindow.$('#login') BTW, you can access child dom only if in same domain Paolo On Tue, Sep 15, 2009 at 10:53 AM, ximo wallas wrote: > > After 1 day googling and trying I find no agreement in a solid method for > comunicating with iframe, this is the nearest point I've been to get in touch > with IFRAME: > > $(frames['Theiframe']).ready( function () > { > alert('Frame is loaded'); > > }); > > This will alert the message, but any attempt to comunicate with the iframe > and access it's contents have been useless, I have a hidden field with with > ID "login" and I'm trying to get it's value: > > $(frames['Theiframe']).find("#login").val(); //Doesn't work in FF 3.0.14 > > / > > var $currentIFrame = $(frames['Theiframe']); > $currentIFrame.contents().find("body #login").val() //Neither does in FF > 3.0.14 > > If you Google a few you will see that everyone is giving it's own opinion on > how to do it, but there's no agreement and no crossbrowser solid solution... > >
[jQuery] Re: Problem with .live() events in a widget in FF3
Is it just because alert() is not allowed in FF? (needs to be alert(1) or some-such). The code looks fine to me otherwise. On Sep 15, 5:38 am, ChrisP wrote: > I am creating a simple jQuery widget and have the following two lines > in the _init() method. > > this.element.find("li.thumb img").css("cursor", "pointer"); > this.element.find("li.thumb img").live("click", function() { alert > (); }); > > The addition of the style property in the first line works in both IE7 > and FF3. However, the binding of the event in the second line only > works in IE7, not in FF3. > > Elements are dynamically added to the widget so I need to use the .live > () method. > > Any thoughts on why this may be occurring? > > Thanks
[jQuery] Re: Simple/short way to bind one event to multiple objects?
you can select multiple objects in the selector, like: $ ("#obj1,#obj2,#obj3").change(...) On Sep 15, 7:42 am, cgp wrote: > I have 2 or more objects that onclick(), will call the same function. > Right now I have the following: > > > $("#obj1").change( function() { > setupPage();}); > > $("#obj2").change( function() { > setupPage();}); > > $("#obj3").change( function() { > setupPage();}); > > > > I was wondering if there is a way to simplify or clean up the code, > since they are all doing the same thing and responding to the same > event. This is just for refactoring reasons because my code is getting > too long/messy. > > Thanks.
[jQuery] Re: Jquery gradient and tabs
On Tue, Sep 15, 2009 at 5:55 PM, MiKiTiE wrote: > > Having checked the source code, it looks like you're not even > including the core and tabs ui. > > For example: > > http://jqueryui.com/latest/ui/ > ui.core.js"> > http://jqueryui.com/latest/ui/ > ui.tabs.js"> > > If you were to link direct to jquery. That may be why your tabs are > not working properly. > No, its not that. I am using this technique http://blueprintcss.org/demos/tabs.html This doesn't need ui.core.js and ui.tabs.js - Anush
[jQuery] Re: Easy show()/hide() Question
The problem is this line: $(this).children('ul').hide('fast'); If you changed to .hide() without the speed, works fine. I dont know if this is a jquery bug. On Mon, Sep 14, 2009 at 09:31, GLSmyth wrote: > > I am missing something fundamental and am sure that someone can point > me in the right direction. > > I have a list like so: > >DD > >Santuary >Stream >Winter > > > > I have styled it so that the list items float. The class DoNotDisplay > hides the unordered list. When the mouse hovers over GalleryMenu then > jQuery removes the DoNotDisplay class so that the unordered list is > displayed, moving off GalleryMenu hides the list. This works fine and > the code is: > > $(document).ready( > function() { >$('li#GalleryMenu').add('li#PoemMenu').hover( > function() { >$(this).children('ul').removeClass('DoNotDisplay'); > }, > function() { >$(this).children('ul').addClass('DoNotDisplay'); > } >); > } > ); > > I would like the unordered list to slide open, so I changed the code > to: > > $(document).ready( > function() { >$('li#GalleryMenu').add('li#PoemMenu').hover( > function() { >$(this).children('ul').show('fast'); >console.log('Open list'); > }, > function() { >$(this).children('ul').hide('fast'); >console.log('Close list'); > } >); > } > ); > > The list opens properly, but does not close when I move the mouse from > the list. When looking at this in Firebug I see that 'hide' is > firing, but for some reason does not close the list. If I "unfloat" > the list then the code works just fine. > > What am I missing? I'm sure that it is staring me in the face, but I > am just not seeing it. The full code can be found at > http://glsmyth.com/Sedwick/Templates/ > > Thanks for looking. > > Cheers - > > george
[jQuery] Re: Get the onclick method of an element
Perhaps then you can extract it as text like I mentioned in my first post, then store it in a variable? As I am not sure what your function does or why it needs to be applied this way, I can't solve the problem exactly - but why not just use an event instead of an onclick in the element? That is what jQuery is there for :-) On Sep 15, 9:50 am, sirrocco wrote: > Well .. that's the problem - i tried it like that and it didn't work. > > When setting the attribute back on the link, the this in DoSomething > (this); is not the link, but the window. > > On Sep 15, 11:41 am,MiKiTiE wrote: > > > Sorry I should have written > > > $('a').attr('onclick',onclick); > > > (setting the attribute value not the inner text!) > > > On Sep 15, 9:09 am, sirrocco wrote: > > > > Let's say you have a : > > > > asd > > > > I want to get the onclick text in a variable - something like > > > > var onclick = $('a').attr('onclick'); > > > > The problem is that the onclick variable now is a function and if I > > > try to execute , this wil be the document instead of the link . > > > > How can I get only the text, so I can later reattach it to the link ?
[jQuery] Re: IE 8 chokes on HTML5 elements inserted with jQuery
2009/9/15 Perceptes : > > I've encountered a problem with the combination of jQuery, IE, and > HTML5 elements. HTML5 elements inserted into the page after initial > load via jQuery's DOM manipulation functions are not parsed correctly > by IE, even with Remy Sharp's HTML5 shiv script. > The problem is that jQuery uses innerHTML, rather than DOM methods, to insert the new content (which is why it's passed to jQuery as a string). This means it relies on IE's HTML parser to correctly parse the markup from the string when it is inserted. When IE's parser encounters an element it doesn't recognise the name of, it creates the element as an empty element (similar to or ), then parses the content as if it were sibling nodes, then creates an empty element whose name begins with a slash (/ARTICLE for example); you can see this on your test page by clicking on the "IE fail" button and then entering: and in the location bar; the first will show "ARTICLE", and the second will show "/ARTICLE". To work around this you basically have two options: 1. Before any other script is executed, add the line: document.createElement("article"); and add equivalent lines for any other HTML5-specific elements you wish to use (such as section). This prompts IE's HTML parser to expect blocks with that tagName and it will then parse them correctly. 2. Don't use jQuery's innerHTML-dependent approach to creating new content; instead, use DOM creation methods directly, for example: var article = document.createElement("article"); var header = article.appendChild(document.createElement("header")); header.appendChild(document.createTextNode("Hello World"); var container = document.getElementsByTagName("div")[0]; container.insertBefore(article, container .getElementsByTagName("h2")[1]); ... and so on. (Actually, you can use jQuery for selecting the correct insertion point and for inserting the new elements there, as jQuery can cope with elements when inserting content.) Regards, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/
[jQuery] Re: Jquery gradient and tabs
Having checked the source code, it looks like you're not even including the core and tabs ui. For example: http://jqueryui.com/latest/ui/ ui.core.js"> http://jqueryui.com/latest/ui/ ui.tabs.js"> If you were to link direct to jquery. That may be why your tabs are not working properly. On Sep 15, 12:15 pm, anush wrote: > On Sep 14, 3:58 pm, MiKiTiE wrote: > > > Could you provide a link? > > http://wildindia.org/mwtest/grad.php > > If you see the there, the Tab #2 is inactive. > > - > Anush
[jQuery] Re: Very disappointed with jquery and iframe communication
Are you sure that $(frames['Theiframe']) is returning the iframe ? On Tue, Sep 15, 2009 at 05:53, ximo wallas wrote: > After 1 day googling and trying I find no agreement in a solid method for > comunicating with iframe, this is the nearest point I've been to get in > touch with IFRAME: > > $(frames['Theiframe']).ready( function () > { > alert('Frame is loaded'); > > }); > > This will alert the message, but any attempt to comunicate with the iframe > and access it's contents have been useless, I have a hidden field with with > ID "login" and I'm trying to get it's value: > > $(frames['Theiframe']).find("#login").val(); //Doesn't work in FF 3.0.14 > > > / > > var $currentIFrame = $(frames['Theiframe']); > $currentIFrame.contents().find("body #login").val() //Neither does in FF > 3.0.14 > > If you Google a few you will see that everyone is giving it's own opinion > on how to do it, but there's no agreement and no crossbrowser solid > solution... > > >
[jQuery] IE 8 chokes on HTML5 elements inserted with jQuery
Hi all, I've encountered a problem with the combination of jQuery, IE, and HTML5 elements. HTML5 elements inserted into the page after initial load via jQuery's DOM manipulation functions are not parsed correctly by IE, even with Remy Sharp's HTML5 shiv script. With the help of jgraham from the WHATWG IRC channel, I have set up a page that shows this problem in two cases: 1) A simplified version of the contact form from my new site where I first encountered this problem. 2) A tiny test script that shows the failure in a stripped down form. The two test cases and full details are here: http://www.jimmycuadra.com/ie8/ Thanks in advance for any insight anyone can provide in how to deal with this.