[jQuery] detecting when jquery affects a form element
Hello all, Is there a way to detect when jquery affects a form field? Something like .change(), but when jquery makes the change, not the user? Thanks! -- Eric Cope
[jQuery] Re: detecting when jquery affects a form element
I figured it out. .trigger('change') works great. Thanks, Eric On Jan 15, 1:43 am, Eric Cope eric.c...@gmail.com wrote: Hello all, Is there a way to detect when jquery affects a form field? Something like .change(), but when jquery makes the change, not the user? Thanks! -- Eric Cope
[jQuery] added form elements not sent using Firefox
Hello all, I am using jquery to copy a DIV containing some form elements. The copy is appended to the DIV in another DIV to allow an unlimited number of form elements to be sent. The problem is that none of the copy DIVs are being sent by the browser (Firefox). There is some chatter via google, but nothing conclusive. I see the DIVs show up in Firebug. Could this be jquery related? Thanks in advance! Eric
[jQuery] slideUp very slow depending on number of fields above
Hello all, I am using the slideUp animation to hide a div. Above the div, are 25 other divs that may or may not be visible. The speed of the slideUp animation depends on how many of those divs are visible. if 25 divs are visible, the animation takes 1200ms. If 20 divs are visible, the animation takes 700ms. If 15 divs are visible, it takes 600ms. If 10 divs are visible, it takes 470-500 ms. if 5 divs are visible it takes ~350ms (as an fyi the slideDown takes 350ms regardless of divs visible). About half the time is spend in css() and half in hidden(). I don't see why it should take upto 600ms to compare two values in hidden(). If I take out slideUp and place in hide() it takes longer! If I take out slideUp and place in document.getElementById(endorsementFeeAdjust).style.display = 'none'; The css() time goes to 0, but hidden is still taking the same amount of time. If I take out the fadeOut and fadeIn, then the hidden drops to 0 as well. Why does hidden take so long? $(#addEndorseFeeBtn).click(function() { if($(#endorsementFeeAdjust).is(:hidden)){ $(#endorsementFeeAdjust).slideDown(slow,function () { $(#addEndorseFeeBtn).fadeOut(fast).text(Remove Endorsement Fee Adjustment).fadeIn(fast); }); } else { $(#endorsementFeeAdjust).slideUp('slow', function () { $(#addEndorseFeeBtn).fadeOut('slow').text(Add Endorsement Fee Adjustment).fadeIn(fast); //$(#endorsementFeeAdjustmentDescription).val(); //$(#endorsementFeeAdjustmentAmount).val(); document.getElementById (endorsementFeeAdjustmentDescription).value = ''; document.getElementById(endorsementFeeAdjustmentAmount).value = ''; }); } }); Thank you, Eric
[jQuery] Re: slideUp very slow depending on number of fields above
Update: My Firefox memory must have been overloaded - I restarted Firefox and the times are down to 100ms, as expected. Could jquery be adding things to the DOM slowing down parsing? Eric On Wed, Jan 13, 2010 at 12:29 AM, Eric Cope eric.c...@gmail.com wrote: Hello all, I am using the slideUp animation to hide a div. Above the div, are 25 other divs that may or may not be visible. The speed of the slideUp animation depends on how many of those divs are visible. if 25 divs are visible, the animation takes 1200ms. If 20 divs are visible, the animation takes 700ms. If 15 divs are visible, it takes 600ms. If 10 divs are visible, it takes 470-500 ms. if 5 divs are visible it takes ~350ms (as an fyi the slideDown takes 350ms regardless of divs visible). About half the time is spend in css() and half in hidden(). I don't see why it should take upto 600ms to compare two values in hidden(). If I take out slideUp and place in hide() it takes longer! If I take out slideUp and place in document.getElementById(endorsementFeeAdjust).style.display = 'none'; The css() time goes to 0, but hidden is still taking the same amount of time. If I take out the fadeOut and fadeIn, then the hidden drops to 0 as well. Why does hidden take so long? $(#addEndorseFeeBtn).click(function() { if($(#endorsementFeeAdjust).is(:hidden)){ $(#endorsementFeeAdjust).slideDown(slow,function () { $(#addEndorseFeeBtn).fadeOut(fast).text(Remove Endorsement Fee Adjustment).fadeIn(fast); }); } else { $(#endorsementFeeAdjust).slideUp('slow', function () { $(#addEndorseFeeBtn).fadeOut('slow').text(Add Endorsement Fee Adjustment).fadeIn(fast); //$(#endorsementFeeAdjustmentDescription).val(); //$(#endorsementFeeAdjustmentAmount).val(); document.getElementById (endorsementFeeAdjustmentDescription).value = ''; document.getElementById(endorsementFeeAdjustmentAmount).value = ''; }); } }); Thank you, Eric -- Eric Cope http://cope-et-al.com
[jQuery] Re: SimpleModal (probably something really stupid)
I would strongly suggest downloading the one of the demos [1], like the basic one, which will probably help answer all of your questions. -Eric [1] http://www.ericmmartin.com/projects/simplemodal-demos/ On Jan 7, 7:57 pm, polarwarp polarw...@gmail.com wrote: I am using the jquery simplemodal code to display a div on a page. I am pretty much calling .modal(); on the div, which has a class on it, and I'm styling up that class - some issues though: 1. How do I add a close button. Have seen that I can add a closeimg style - but I can't get anything with this class to appear. I figure I need to set the closehtml property to something but haven't figured out what. As this is embedded in c# I might have stuffed up my string escaping. string termconditions = @$('# + pnlMemberAgreement.ClientID + ').modal({ closeHTML: ''});; I also tried a href=#Close/a instead of just '' - but either its making no difference or I can't figure out what quotations to use within my c# string. .simplemodal-container a.modalCloseImg { background:url(../App_Themes/Images/Ecommerce/x.png) no-repeat; width:25px; height:29px; display:inline; z-index:3200; position:absolute; top:-14px; right:-18px; cursor:pointer; } 2. Whilst the div is made visible, it sits under my content - its not being overlayed over the top, nor does it have a background colour going on. I grabbed from the sample site: .simplemodal-overlay { background-color:#000; cursor:wait; } .simplemodal-container { height:400px; width:600px; background-color:#fff; border:3px solid #ccc; } Is this an additional option I need to set? 3. The div is not acting like a modal object - I can still click other buttons and stuff on the same page and leave the page! 4. I'm confused with the styling. what do I need to put on my div so that the right styles get applied to it - or should I be doing this in options? ie. I have my tc inside a panel, and I tried putting a css class on that for the container part, but where do I put the overlay - or should I not have to do this. It sort of looks like the basic modal example does what I want it to do.. but I can't figure out what I have missed in my implementation of it :( I pretty much have this in my c# string termconditions = @$('# + pnlMemberAgreement.ClientID + ').modal();; and want to apply some basic stylings so that the frontend guy can take over but it will do what its supposed to Thanks for any assistance!
[jQuery] how to access elements with index in for-loop
when i use for-loop to access elements with array index or get() method it doesn't work. but i have to use the index to access, what happen please . ok: http://jsbin.com/olego wrong: http://jsbin.com/ulixu
[jQuery] Re: how to access elements with index in for-loop
2009/12/24 Eric Zhong ericiszhongwen...@gmail.com when i use for-loop to access elements with array index or get() method it doesn't work. but i have to use the index to access, what happen please . ok: http://jsbin.com/olego wrong: http://jsbin.com/ulixu wrong:http://jsbin.com/axugi
Re: [jQuery] Re: how to access elements with index in for-loop
2009/12/24 Richard D. Worth rdwo...@gmail.com What about using .each? http://docs.jquery.com/Core/each#callback - Richard On Wed, Dec 23, 2009 at 8:34 PM, Eric Zhong ericiszhongwen...@gmail.comwrote: 2009/12/24 Eric Zhong ericiszhongwen...@gmail.com when i use for-loop to access elements with array index or get() method it doesn't work. but i have to use the index to access, what happen please . ok: http://jsbin.com/olego wrong: http://jsbin.com/ulixu wrong:http://jsbin.com/axugi thank you, i have tested .each(), it works well , but i need the index, may be the .each() can carry out too, but i think the index will more simple.
Re: [jQuery] Re: how to access elements with index in for-loop
thanks again, i think i have understand your mind. Thanks! 2009/12/24 Richard D. Worth rdwo...@gmail.com The index is passed as the first argument to the callback function you provide to .each. - Richard On Wed, Dec 23, 2009 at 8:49 PM, Eric Zhong ericiszhongwen...@gmail.comwrote: 2009/12/24 Richard D. Worth rdwo...@gmail.com What about using .each? http://docs.jquery.com/Core/each#callback - Richard On Wed, Dec 23, 2009 at 8:34 PM, Eric Zhong ericiszhongwen...@gmail.com wrote: 2009/12/24 Eric Zhong ericiszhongwen...@gmail.com when i use for-loop to access elements with array index or get() method it doesn't work. but i have to use the index to access, what happen please . ok: http://jsbin.com/olego wrong: http://jsbin.com/ulixu wrong:http://jsbin.com/axugi thank you, i have tested .each(), it works well , but i need the index, may be the .each() can carry out too, but i think the index will more simple.
Re: [jQuery] Re: how to access elements with index in for-loop
thank you very much, your way is better than mine ! 2009/12/24 Šime Vidas sime.vi...@gmail.com First of all, the wrong code is wrong, look this is your code: $(function(){ var trs = $(#tb tr:not(:first)) for( var i=0; i$trs.length; i++ ) { //$trs[i].find(td:eq(1)).attr(style,color:red); //wrong $trs.get(i).find(td:eq(1)).attr(style,color:red); //wrong } }) 1. you forgot to put semicolons at two places. $(function(){ var trs = $(#tb tr:not(:first)); -- HERE for( var i=0; i$trs.length; i++ ) { //$trs[i].find(td:eq(1)).attr(style,color:red); //wrong $trs.get(i).find(td:eq(1)).attr(style,color:red); //wrong } }); -- HERE 2. You declared a variable named trs but you than use a varibale named $trs which of course doesn't exist because you haven't declared it... $(function(){ var $trs = $(#tb tr:not(:first)); for( var i=0; i$trs.length; i++ ) { //$trs[i].find(td:eq(1)).attr(style,color:red); //wrong $trs.get(i).find(td:eq(1)).attr(style,color:red); //wrong } }); OK, now the code should work, right? Well, no... because what the get(i) method does is it returns the DOM element at index i from the $trs jQuery obect so after you do get (i), you no longer have an jQuery object, and you cannot call the find () method because it is not a property of DOM elements What you could do is encapsulate $trs.get(i) inside $() to get a jQuery object based on the DOM element, so this code does work: $($trs.get(i)).find(td:eq(1)).attr(style, color:red); However, this is a pretty stupid way to loop through a jQuery object... a better way is to use the each() method: $trs.each(function() { $(this).find(td:eq(1)).attr(style, color:blue); });
[jQuery] The most incredible thing happened
I just add a pair of form label in my code, it doesn't work !!! In my project I was called the js file, but in order to show clearly, I put them together,and Shortened the code Error: http://jsbin.com/oyeki OK: http://jsbin.com/iviba3
[jQuery] Re: The most incredible thing happened
i kill the bug, the id must different from the function name http://jsbin.com/ujota3 2009/12/10 Eric Zhong ericiszhongwen...@gmail.com I just add a pair of form label in my code, it doesn't work !!! In my project I was called the js file, but in order to show clearly, I put them together,and Shortened the code Error: http://jsbin.com/oyeki OK: http://jsbin.com/iviba3
Re: [jQuery] Re: Very Strange !!! The same HTML code works well, but append() it not !!!
Michael, thank you very much I find the bug, the last tr should be /tr. $(#tb_video).append('tr tdinput type=checkbox //tdtd' + d.name + '/tdtd' + d.len + '/tdtd' + d.size + '/tdtr'); this bug trouble me more than 2 days, thank you again, you not only give a good tools which aid me to find the bug, also you show me a way to find bug ! I kill another bug use View Source Chart less than 2 minute which trouble me in a long time too. Thank You !!! 2009/12/9 Michael Geary m...@mg.to Hi Eric, Please forgive me for not explaining clearly. Here is what I meant by a test page: post your HTML page on a website somewhere and give us the URL to that page. Then we can click the link and load your page, just like any other web page. That makes it much easier to help you troubleshoot. Here, since I didn't explain myself well, I went ahead and uploaded your files to my own site: http://mg.to/test/zhong/OK.html http://mg.to/test/zhong/Error.html Now when I load the page I can see the strange behavior you noticed. I also noticed that the two pages display slightly differently from each other. Do you see how the Error page has more spacing between the rows than the OK page? This made me think there is something different in the dynamically generated code. To find the difference, I used the View Source Chart extension for Firefox: https://addons.mozilla.org/en-US/firefox/addon/655 along with the Araxis Merge file comparison program: http://www.araxis.com/ I opened your OK.html file in Firefox and selected View Source Chart from the View menu. I also opened a new file comparison window in Araxis Merge. (Araxis Merge is an excellent but fairly expensive commercial product. You could use any file comparison or diff program, though.) Then I did a select all and copy, and pasted the result into the left panel in Araxis Merge. I did the same thing with your Error.html file and pasted the result into the right panel in Araxis Merge. This showed me the difference between the straight HTML version and the JavaScript-generated version. I saved the comparison report here for you to look at: http://mg.to/test/zhong/compare.html Scroll down in that page and take a look around line 116 on the left, line 256 on the right. Do you see the extra /tr and tr tags there, and the same thing in the lines below that? In the JavaScript-generated version, there is an *extra* empty table row in between each of your table rows. This is why your up and down buttons are acting strangely. They probably *are* moving the table row(s) up and down as expected, but those empty table rows are interfering with that. I'm sure if you get rid of the empty rows it will work as you want. This also explains why there is a small difference in layout between the two versions. Do you see where the JavaScript version has more spacing between the rows (at least in Firefox)? That is caused by the empty rows. I'll let you sort out what part of your JavaScript code is causing those extra rows to be added. Hope that helps, -Mike On Tue, Dec 8, 2009 at 1:59 AM, Eric Zhong ericiszhongwen...@gmail.comwrote: thanks for your reply, my english is poor , i can't understand what is test page, you meant src file or description for the result ??? description: 1. when you use HTML code, it runs well , you can select one or more select box and click up or down button, the selected line will up and down immediately. 2. but when you use jQuery to append() the code , you do the same action , the selected line, will move or not some times, and when you multiselect lines, you will see the strange result, it's hard to say with my poor english, sorry !!! i attach 2 files, one is OK, and another is Error. you can run it (double click) , and to opt and to see what difference. 2009/12/8 Michael Geary m...@mg.to Eric, you really need to put up a test page so we can try actually loading it. Otherwise it's too hard to tell what might be wrong. I'm not even sure what the problem is we're supposed to be looking at! -Mike On Mon, Dec 7, 2009 at 11:44 PM, Eric Zhong ericiszhongwen...@gmail.com wrote: i have modified the code , but the result is the same, even if i write this in one line !!! Help !!! one line version: html head script src= http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js;/script SCRIPT LANGUAGE=JavaScript !-- $(function(){ // /* var html_video ='table id=tb_all width=724pxtrtd valign=toptable id=tb_video class=tb_widthtr class=tb_headtdnbsp/tdtdfilename/tdtdlen(s)/tdtdsize(KB)/td/tr/table/td/tr/table'; $(body).append( html_video ); var data
[jQuery] Very Strange !!! The same HTML code works well, but append() it not !!!
html head script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/ jquery.js/script SCRIPT LANGUAGE=JavaScript !-- $(function(){ // /* var html_video = ' \ table id=tb_all width=724px \ tr \ td valign=top \ table id=tb_video class=tb_width \ tr class=tb_head \ tdnbsp/td \ tdfilename/td \ tdlen(s)/td \ tdsize(KB)/td \ /tr \ /table \ /td \ /tr \ /table' $(body).append( html_video ); var data = [ {name: 1, len: 432, size: 321}, {name: 2, len: 54543, size: 432}, {name: 3, len: 3243, size: 432}, {name: 4, len: 543, size: 432}, {name: 5, len: 543, size: 654}, {name: 6, len: 654, size: 654}, {name: 7, len: 765, size: 654}, {name: 8, len: 765, size: 765}, {name: 9, len: 53, size: 654} ]; var a = data; if ( a != null ){ for(var i=0; ia.length; i++){ var d = a[i]; $(#tb_video).append(' \ tr \ tdinput type=checkbox //td \ td' + d.name + '/td \ td' + d.len + '/td \ td' + d.size + '/td \ tr '); } } $(#tb_video).closest(tr).append(' \ td width=80px align=center style=vertical-align:top \ input id=pl_bt_up type=button value=↑ / \ input id=pl_bt_down type=button value=↓ / \ /td '); // */ $(#pl_bt_up).click(function() { var $all = $(#tb_video tr); var $trs = $(#tb_video tr:has(input:checked)); if( $all.index($trs.get(0)) != 1 ){ $trs.each(function(){ $(this).prev().before($(this)); }); } }); $(#pl_bt_down).click(function() { var $all = $(#tb_video tr); var $trs = $(#tb_video tr:has(input:checked)); if( $all.index( $trs.get($trs.length-1) ) != $all.length-1 ){ for( i = $trs.length-1; i=0; i-- ) { var $item = $( $trs.get(i) ); $item.insertAfter($item.next()); } } }); }); -- /SCRIPT /head body !-- table id=tb_all width=724px tr td valign=top table id=tb_video class=tb_width tr class=tb_head tdnbsp/td tdfilename/td tdlen(s)/td tdsize(KB)/td /tr trtdinput type=checkbox //tdtd1/ tdtd222/tdtd432/td/tr trtdinput type=checkbox //tdtd2/ tdtd333/tdtd543/td/tr trtdinput type=checkbox //tdtd3/ tdtd444/tdtd654/td/tr trtdinput type=checkbox //tdtd4/ tdtd555/tdtd765/td/tr trtdinput type=checkbox //tdtd5/ tdtd666/tdtd876/td/tr trtdinput type=checkbox //tdtd6/ tdtd777/tdtd432/td/tr trtdinput type=checkbox //tdtd7/ tdtd888/tdtd543/td/tr trtdinput type=checkbox //tdtd8/ tdtd999/tdtd265/td/tr /table /td td width=80px align=center style=vertical- align:top input id=pl_bt_up type=button value=↑ / input id=pl_bt_down type=button value=↓ / /td /tr /table -- /body /html
[jQuery] The target HTML code works very well, but append() not !!!
when you run the code below, you'll get a very strange result. But if you run the target html that be commented, it works very well , what happen ??? Help!!! = html head script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/ jquery.js http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js /script SCRIPT LANGUAGE=JavaScript !-- $(function(){ // /* var html_video = ' \ table id=tb_all width=724px \ tr \ td valign=top \ table id=tb_video class=tb_width \ tr class=tb_head \ tdnbsp/td \ tdfilename/td \ tdlen(s)/td \ tdsize(KB)/td \ /tr \ /table \ /td \ /tr \ /table' $(body).append( html_video ); var data = [ {name: 1, len: 432, size: 321}, {name: 2, len: 54543, size: 432}, {name: 3, len: 3243, size: 432}, {name: 4, len: 543, size: 432}, {name: 5, len: 543, size: 654}, {name: 6, len: 654, size: 654}, {name: 7, len: 765, size: 654}, {name: 8, len: 765, size: 765}, {name: 9, len: 53, size: 654} ]; var a = data; if ( a != null ){ for(var i=0; ia.length; i++){ var d = a[i]; $(#tb_video).append(' \ tr \ tdinput type=checkbox //td \ td' + d.name + '/td \ td' + d.len + '/td \ td' + d.size + '/td \ tr '); } } $(#tb_video).closest(tr). append(' \ td width=80px align=center style=vertical-align:top \ input id=pl_bt_up type=button value=up / \ input id=pl_bt_down type=button value=down / \ /td '); // */ $(#pl_bt_up).click(function() { var $all = $(#tb_video tr); var $trs = $(#tb_video tr:has(input:checked)); if( $all.index($trs.get(0)) != 1 ){ $trs.each(function(){ $(this).prev().before($(this)); }); } }); $(#pl_bt_down).click(function() { var $all = $(#tb_video tr); var $trs = $(#tb_video tr:has(input:checked)); if( $all.index( $trs.get($trs.length-1) ) != $all.length-1 ){ for( i = $trs.length-1; i=0; i-- ) { var $item = $( $trs.get(i) ); $item.insertAfter($item.next()); } } }); }); -- /SCRIPT /head body !-- table id=tb_all width=724px tr td valign=top table id=tb_video class=tb_width tr class=tb_head tdnbsp/td tdfilename/td tdlen(s)/td tdsize(KB)/td /tr trtdinput type=checkbox //tdtd1/ tdtd222/tdtd432/td/tr trtdinput type=checkbox //tdtd2/ tdtd333/tdtd543/td/tr trtdinput type=checkbox //tdtd3/ tdtd444/tdtd654/td/tr trtdinput type=checkbox //tdtd4/ tdtd555/tdtd765/td/tr trtdinput type=checkbox //tdtd5/ tdtd666/tdtd876/td/tr trtdinput type=checkbox //tdtd6/ tdtd777/tdtd432/td/tr trtdinput type=checkbox //tdtd7/ tdtd888/tdtd543/td/tr trtdinput type=checkbox //tdtd8/ tdtd999/tdtd265/td/tr /table /td td width=80px align=center style=vertical- align:top input id=pl_bt_up type=button value=up / input id=pl_bt_down type=button value=down / /td /tr /table -- /body /html
Re: [jQuery] Re: Very Strange !!! The same HTML code works well, but append() it not !!!
i have modified the code , but the result is the same, even if i write this in one line !!! Help !!! one line version: html head script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js /script SCRIPT LANGUAGE=JavaScript !-- $(function(){ // /* var html_video ='table id=tb_all width=724pxtrtd valign=toptable id=tb_video class=tb_widthtr class=tb_headtdnbsp/tdtdfilename/tdtdlen(s)/tdtdsize(KB)/td/tr/table/td/tr/table'; $(body).append( html_video ); var data = [ {name: 1, len: 432, size: 321}, {name: 2, len: 54543, size: 432}, {name: 3, len: 3243, size: 432}, {name: 4, len: 543, size: 432}, {name: 5, len: 543, size: 654}, {name: 6, len: 654, size: 654}, {name: 7, len: 765, size: 654}, {name: 8, len: 765, size: 765}, {name: 9, len: 53, size: 654} ]; var a = data; if ( a != null ){ for(var i=0; ia.length; i++){ var d = a[i]; $(#tb_video).append('trtdinput type=checkbox //tdtd' + d.name + '/tdtd' + d.len + '/tdtd' + d.size + '/tdtr'); } } $(#tb_video).closest(tr).append('td width=80px align=center style=vertical-align:topinput id=pl_bt_up type=button value=↑ /input id=pl_bt_down type=button value=↓ //td'); // */ $(#pl_bt_up).click(function() { var $all = $(#tb_video tr); var $trs = $(#tb_video tr:has(input:checked)); if( $all.index($trs.get(0)) != 1 ){ $trs.each(function(){ $(this).prev().before($(this)); }); } }); $(#pl_bt_down).click(function() { var $all = $(#tb_video tr); var $trs = $(#tb_video tr:has(input:checked)); if( $all.index( $trs.get($trs.length-1) ) != $all.length-1 ){ for( i = $trs.length-1; i=0; i-- ) { var $item = $( $trs.get(i) ); $item.insertAfter($item.next()); } } }); }); -- /SCRIPT /head body !-- table id=tb_all width=724px tr td valign=top table id=tb_video class=tb_width tr class=tb_head tdnbsp/td tdfilename/td tdlen(s)/td tdsize(KB)/td /tr trtdinput type=checkbox //tdtd1/tdtd222/tdtd432/td/tr trtdinput type=checkbox //tdtd2/tdtd333/tdtd543/td/tr trtdinput type=checkbox //tdtd3/tdtd444/tdtd654/td/tr trtdinput type=checkbox //tdtd4/tdtd555/tdtd765/td/tr trtdinput type=checkbox //tdtd5/tdtd666/tdtd876/td/tr trtdinput type=checkbox //tdtd6/tdtd777/tdtd432/td/tr trtdinput type=checkbox //tdtd7/tdtd888/tdtd543/td/tr trtdinput type=checkbox //tdtd8/tdtd999/tdtd265/td/tr /table /td td width=80px align=center style=vertical-align:top input id=pl_bt_up type=button value=↑ / input id=pl_bt_down type=button value=↓ / /td /tr /table -- /body /html 2009/12/8 seasoup seas...@gmail.com javascript cant read strings over line breaks. $(#tb_video).append(' \ tr \ tdinput type=checkbox //td \ td' + d.name + '/td \ td' + d.len + '/td \ td' + d.size + '/td \ tr '); must be $(#tb_video).append('tr'+ 'tdinput type=checkbox //td'+ 'td' + d.name + '/td'+ 'td' + d.len + '/td'+ 'td' + d.size + '/td'+ 'tr '); On Dec 7, 6:30 pm, Eric Zhong ericiszhongwen...@gmail.com wrote: html head script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/ jquery.js/script SCRIPT LANGUAGE=JavaScript !-- $(function(){ // /* var html_video = ' \ table id=tb_all width=724px \ tr \ td valign=top
[jQuery] When plugin ajaxform meets FCKeditor.
Hi all, sorry for my bad English. I use the plugin named ajaxform, when I ajax post the form, I found the fckeditor's value does not post. I checked the codes of ajaxform, there are some some codes as follows: // hook for manipulating the form data before it is extracted; // convenient for use with rich editors like tinyMCE or FCKEditor var veto = {}; this.trigger('form-pre-serialize', [this, options, veto]); if (veto.veto) { log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); return this; } I guess it is the way to fix the bug I meet, but, how to use it? Thank your very much! Eric.
[jQuery] Re: $.getScript results in two requests!
Hey there, Thanks for your answers. Sorry I didn't reply earlier, been pretty busy. It turned out the problem was caused by an old version of Firebug ( http://code.google.com/p/fbug/issues/detail?id=928 ). I am now using Firebug 1.3 on Firefox 3.5, where the bug is fixed. Eric On 25 Nov., 17:03, donb falconwatc...@comcast.net wrote: Be very certain you don't accidentally bind a click function twice somehow. Assuming, that is, a click initiates the action. Setting a Firebug breakpoint on entry to the repeated code, then inspecting the Stack panel to see how you got there each time, will probably reveal how this occurs. On Nov 24, 9:50 am, Eric ikeah...@gmail.com wrote: Hey there, A $.getScript() call I am making results in two seperate requests to the server. Any chance I can avoid that? Here are the headers: GET server.file?param1=param2 HTTP/1.1 Host: server User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; de; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20 Accept: text/javascript, application/javascript, */* Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive X-Requested-With: XMLHttpRequest Referer:http://server/indexfile.html Cookie: (Cookie Contents) Followed by... GET server.file?param1=param2 HTTP/1.1 Host: server User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; de; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20 Accept: text/xml,application/xml,application/xhtml+xml,text/ html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: (Cookie Contents) The web server runs IIS6. Thanks for your help Eric
[jQuery] Re: Issue with simplemodal plugin and absolute positioned content
I've found a workaround. It appears that IE has some rendering bugs that collapses content in certain situations. The workaround I've found is to set the IE-specific zoom style to 1 on elements that exibit this behavior. The trick is that this needs to be applied after the new divs are injected into the body. I added the following onShow function when opening the modal: $(#dialogContent).modal({ overlay:80, overlayCss: {backgroundColor:#000}, containerCss: {'background-color':'#fff', 'padding':'5px', 'border':'2px solid black'}, onShow:function (dialog) {$(body).css({zoom: '1'});} }); And that fixes the issue. In this case, the rendering bug only seems to happen when content is injected into the DOM. I ran a test by exporting the realized DOM after simplemodal rendered the overlay (without the zoom fix applied) and saved the the content as a static page. When loading this page, everything rendered correctly. I'm not sure if you want to integrate the above IE fix into the simplemodal code, but at least if someone else hits this issue, a solution exists! Eric
[jQuery] Issue with simplemodal plugin and absolute positioned content
Hello, I am having an issue with the simplemodal plugin that I’m hoping someone will have a solution for – or at least tell me what is happening. I have a layout which uses absolute divs to provide a three-column liquid layout. In IE 6 and 7, when simplemodal fires, any div that has both a left and right style defined (providing the liquid portion of the layout) collapses to a width of 1 pixel. Any div that only has a left/right element and a width defined behaves correctly. Adding a conditional width to the liquid portion of the layout makes IE behave correctly, but the content is no longer liquid. Below is the simplest piece of sample code I could produce that shows the behavior. Any help would be appreciated – I’ve spent several days trying to solve this issue with no luck so far. Eric Getchell !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head title/title script type=text/javascript src=jquery-1.3.2.min.js/script script type=text/javascript src=jquery.simplemodal-1.3.3.js/ script style type=text/css * { padding: 0; margin: 0; } body { overflow: auto; height: 100%; width: 100%; } #header-left { border: 1px solid blue; position: absolute; top: 0px; left: 0px; width: 300px; height: 83px; overflow: hidden; } #header-right { border: 1px solid red; position: absolute; top: 0px; /* Defining oth left and right in IE will collapse content when simplemodal fires.*/ left: 302px; right: 0px; height: 83px; overflow: hidden; } #main { position: absolute; top: 205px; left: 151px; right: 15px; bottom: 35px; overflow: auto; /style script type=text/javascript function showModal() { $(#dialogContent).modal({ overlay:80, overlayCss: {backgroundColor:#000}, containerCss: {'background-color':'#fff', 'padding':'5px', 'border':'2px solid black'} }); } /script /head body div div id=header-leftThis is a fixed region/div div id=header-rightThis is a liquid region. This collapses in IE/ div /div div id=maina href=# onclick=javascript:showModal();Launch/ a/div div id=dialogContent style=display:noneThis is the modal content/div /body /html
[jQuery] Re: Issue with simplemodal plugin and absolute positioned content
Eric, I don't have IE6 installed (just got a new laptop with windows 7), but I wasn't able to reproduce the issue in IE8 compatibility mode. SimpleModal only styles the dialog element, so I'm not sure why that would be affecting other divs on your page... -Eric On Nov 26, 4:50 am, Eric Getchell eric.getch...@gmail.com wrote: Hello, I am having an issue with the simplemodal plugin that I’m hoping someone will have a solution for – or at least tell me what is happening. I have a layout which uses absolute divs to provide a three-column liquid layout. In IE 6 and 7, when simplemodal fires, any div that has both a left and right style defined (providing the liquid portion of the layout) collapses to a width of 1 pixel. Any div that only has a left/right element and a width defined behaves correctly. Adding a conditional width to the liquid portion of the layout makes IE behave correctly, but the content is no longer liquid. Below is the simplest piece of sample code I could produce that shows the behavior. Any help would be appreciated – I’ve spent several days trying to solve this issue with no luck so far. Eric Getchell !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head title/title script type=text/javascript src=jquery-1.3.2.min.js/script script type=text/javascript src=jquery.simplemodal-1.3.3.js/ script style type=text/css * { padding: 0; margin: 0; } body { overflow: auto; height: 100%; width: 100%; } #header-left { border: 1px solid blue; position: absolute; top: 0px; left: 0px; width: 300px; height: 83px; overflow: hidden; } #header-right { border: 1px solid red; position: absolute; top: 0px; /* Defining oth left and right in IE will collapse content when simplemodal fires.*/ left: 302px; right: 0px; height: 83px; overflow: hidden;} #main { position: absolute; top: 205px; left: 151px; right: 15px; bottom: 35px; overflow: auto; /style script type=text/javascript function showModal() { $(#dialogContent).modal({ overlay:80, overlayCss: {backgroundColor:#000}, containerCss: {'background-color':'#fff', 'padding':'5px', 'border':'2px solid black'} });} /script /head body div div id=header-leftThis is a fixed region/div div id=header-rightThis is a liquid region. This collapses in IE/ div /div div id=maina href=# onclick=javascript:showModal();Launch/ a/div div id=dialogContent style=display:noneThis is the modal content/div /body /html
[jQuery] Re: Issue with simplemodal plugin and absolute positioned content
Hey Eric, Thanks for checking into this. I've done some more digging and I've narrowed the issue down to the container/wrapping div that is injected into the DOM. If I remove the following from the container (s.d.container) when it is created: display: 'none', position: 'fixed', ..the divs on the page do not collapse (of course the modal does not correctly render, but that is to be expected). If I remove the following three items from the wrapping div (s.d.wrap) when it is created: .attr('tabIndex', -1) .addClass('simplemodal-wrap') .css({height: '100%', outline: 0, width: '100%'}) ... it renders correctly in IE 6,7 and Firefox. The odd thing is that I have to remove all three, any combination of the three items will cause the divs to collapse. If found the fact that all three needed to be removed surprising as I would have expected the tab index modification to have no impact to the page layout. I'm still looking, but if anything above seems to point to the cause, let me know! Eric
[jQuery] $.getScript results in two requests!
Hey there, A $.getScript() call I am making results in two seperate requests to the server. Any chance I can avoid that? Here are the headers: GET server.file?param1=param2 HTTP/1.1 Host: server User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; de; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20 Accept: text/javascript, application/javascript, */* Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive X-Requested-With: XMLHttpRequest Referer: http://server/indexfile.html Cookie: (Cookie Contents) Followed by... GET server.file?param1=param2 HTTP/1.1 Host: server User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; de; rv:1.8.1.20) Gecko/20081217 Firefox/2.0.0.20 Accept: text/xml,application/xml,application/xhtml+xml,text/ html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: (Cookie Contents) The web server runs IIS6. Thanks for your help Eric
[jQuery] Re: SimpleModal 1.33 Fix
Actually, the values are correct, this isn't a bug. mh and mw stand for maximum height and maximum width. ;) That isn't apparent from the variable names, but you can tell when they are assigned. -Eric On Nov 15, 9:11 pm, Enobrev enob...@gmail.com wrote: Found a bug in SimpleModal 1.33 - If Content Height is Greater Than the Minimum Height, the Content Height should be Minimum Height. + If Content Height is Less Than the Minimum Height, the Content Height should be Minimum Height. @@ -463,7 +463,7 @@ } } else { - ch = ch mh ? mh : ch; + ch = ch mh ? mh : ch; } - If Content Width is Greater Than the Minimum Width, the Content Width should be Minimum Width. + If Content Width is Less Than the Minimum Width, the Content Width should be Minimum Width. @@ -476,14 +476,13 @@ } } else { - cw = cw mw ? mw : cw; + cw = cw mw ? mw : cw; }
[jQuery] Re: SimpleModal issues when loading content via Ajax
I determined what was the issued and will post my solution here in case others encounter the same problem. I incorrectly assumed the .load() call was a synchronous (blocking) call, which it is not. Therefore, the SimpleModal call was processing the empty div before the content had finished being served. I updated the code to use a callback function to display the modal dialog and everything now works correctly: $(#dialog).load(/snippet.html, {}, function() { $(#dialog).modal({ overlay:80, overlayCss: {backgroundColor:#000} }); });
[jQuery] SimpleModal issues when loading content via Ajax
Hello, I’m having two issues with the SimpleModal jQuery plugin that I’m sure someone knows the answers to. Essentially, I am using SimpleModal to display informational windows/forms and I encountered an issue when loading the display content via Ajax. To ensure that the rendering problems were not a symptom of the HTML snippet that is being loaded, I removed the Ajax call and embedded the content directly into the div container - the page behaved correctly. If I load the exact same HTML snippet via Ajax, I have encountered the following two issues: - The “Close” button (which has the simplemodal-close class associated to it) does not seem to close the modal window when clicked - The positioning of the modal window has been calculated as if the div containing the content was empty, so the window appears towards the bottom of the screen It would seem that an extra step needs to be taken after loading the content via Ajax so that it is correctly processed by the Simple Modal logic. Does anyone know what I would need to do to make this happen? The following is my code that loads the content via Ajax: function testSimpleModal() { $(#dialog).load(/snippet.html); $(#dialog).modal({ overlay:80, overlayCss: {backgroundColor:#000}, onShow: function (dialog){ $(#dialog.simplemodal-close).click(function (e) { alert(); // Test to see if forcing an event handler solves the issue $.modal.close(); }); } }); } … and of course the div that is holding the content can’t get much simpler: div id=dialog style=display:none/div
[jQuery] Re: resize.simplemodal
There are a few different ways you could handle this. I've provided a couple of ideas below 1) after you get the ajax content, check it's height/width and adjust the container dimensions accordingly: $('#modal').modal({ onShow: function (d) { $('#modalclick', d.container[0]).click(function (e) { $.get('data.php', function (response) { d.data.empty().append(response); d.container.css({height:d.data.outerHeight(true), width:d.data.outerWidth(true)}); // you could also animate this }); }); } }); or 2) after you get the ajax content, reset the container dimensions and then call setContainerDimensions() Example: $('#modal').modal({ onShow: function (d) { var sm = this; $('#modalclick', d.container[0]).click(function (e) { $.get('data.php', function (response) { d.data.empty().append(response); d.container.css({height:0, width:0}); // reset dimensions sm.setContainerDimensions(); }); }); } }); HTH -Eric On Nov 9, 7:53 am, Milos Negovanovic milos.negovano...@googlemail.com wrote: Hi, I have been searching for a way to resizesimplemodaldialog after showing it. In plugin source i can see that a function 'resize.simplemodal' is bound to window on initialization. Ive tried to call this function directly with no luck. Is there a way to havesimplemodalrecalculate its size after loading/showing? (I need this since extra content is beeing loaded via AJAX after showing the dialog initialy) Regards Milos
[jQuery] Re: SimpleModal problem in IE7
Bruce, Thanks for reporting the issue. I was able to reproduce the issue and will work on a fix. -Eruc On Oct 29, 10:51 pm, Bruce MacKay b.mac...@massey.ac.nz wrote: Hi folks, I've just updated a previously functioning piece of code that uses the simplemodal plugin - the code does an ajax call to a file containing a email form and loads it into a modal layer. The code now longer works in IE7 using the latest version of simplemodal (http://www.ericmmartin.com/simplemodal-1-3-2-released/) - I notice that the contact form example at eric's site (http://www.ericmmartin.com/projects/simplemodal-demos/- from which I developed my code) no longer works either - the modal layer is formed but the content is garbled, just as it occurs with mine. Anyone else noticed this problem? Thanks, Bruce
[jQuery] Re: SimpleModal problem in IE7
I fixed the issue and released 1.3.3[1]. I updated the demo downloads, but all you need to do is use the newest version of SimpleModal. -Eric [1] http://code.google.com/p/simplemodal/downloads/list On Oct 30, 6:20 am, Eric Martin emarti...@gmail.com wrote: Bruce, Thanks for reporting the issue. I was able to reproduce the issue and will work on a fix. -Eruc On Oct 29, 10:51 pm, Bruce MacKay b.mac...@massey.ac.nz wrote: Hi folks, I've just updated a previously functioning piece of code that uses the simplemodal plugin - the code does an ajax call to a file containing a email form and loads it into a modal layer. The code now longer works in IE7 using the latest version of simplemodal (http://www.ericmmartin.com/simplemodal-1-3-2-released/) - I notice that the contact form example at eric's site (http://www.ericmmartin.com/projects/simplemodal-demos/-from which I developed my code) no longer works either - the modal layer is formed but the content is garbled, just as it occurs with mine. Anyone else noticed this problem? Thanks, Bruce
[jQuery] Fast Table Cell Selection
Im trying to manipulate a subset of a table and selecting the elements with my poorly written jquery is orders of magnitude slower than a simple direct DOM access of the elements using for(y;...) for(x;...) table.rows[y].cells[x]._do stuff_ I know both the starting and ending row and starting and ending column, but i cant get that all into a single snappy jQuery selection. A couple of things ive tried : // worst performance for(y;...) for(x;...) $(table tr:eq(y) td:eq(x))._do stuff_ //still bad $(table tr:lt(endy):gt(starty)).each(function(i) { if ( startx = i%table.rows.length = endx ) _do stuff_ }); I imagine there has to be a way to get all the cells from the rows columns my user has selected in a manner that is _nearly_ as efficient as direct DOM access and let me use all the power of jquery at the same time.
[jQuery] Re: Fast Table Cell Selection
My second example isnt right. the selector should include the TD [e.g. $(table tr:lt(endy):gt(starty) td) ] and after further testing, it performs reasonably well except: the lt/gt is non inclusive and I cant access the first row using gt(-1) as it is zero indexed.
[jQuery] Re: Simple Modal Close Event
If you use the onClose callback, you must call $.modal.close() to remove the dialog elements from the DOM. If an onClose callback has been used, calling $.modal.close() will not trigger the callback again, it can only happen once. I suggest using the onShow callback to bind your second event based on closing the dialog and then call $.modal.close() from there, which will trigger the onClose calback (which is really just supposed to be used for closing animations, etc.). Hope that helps. -Eric On Oct 16, 3:56 am, biggerandbetterkah...@googlemail.com biggerandbetterkah...@googlemail.com wrote: I'm using the simpleModal plugin to display dialog windows. I have a callback on the onclose event which fires another event. Is it correct that the $.modal.close() does not fire the onclose callback. If this is correct is there a way i could workaround this?
[jQuery] Re: IE: call function defined in ajax loaded page
Michael, Is it possible to provide a link or post some code examples of what you are trying to do. If it is undefined in IE, it may be caused by the way you are loading the scripts or the order you have them in. You might also try putting all of your code inside a document ready block to make sure nothing is trying to fire too early. Hope that helps. -Eric On Oct 15, 3:04 am, Michael Anckaert michael.ancka...@gmail.com wrote: Hello everyone, In one of my projects I use simplemodal to show an ajax loaded dialog. The HTML page loaded by the ajax call defines a javascript function setup_dialog() that I use to initialize some functions specific to that page. In the simplemodal callback onShow I call setup_dialog(). This setup works perfectly in Firefox, in IE on the other hand (you already know where this is going :)) the function setup_dialog() is undefined. I tried replacing setup_dialog() with the jquery $(document).ready() function but to no avail. Am I trying to do the impossible in IE? Kind regards, Michael
[jQuery] How to achieve this animation?
Hi, this is Eric from Shanghai China, sorry for my bad English. I am a jQuery Fans. My site is now under building, the page of the animation is: http://www.imczy.com/EN/support-me.html The codes I achieve this animation are as follows: //like goadddy $.fn['_fadeOut'] = function(){ this.css('overflow', 'hidden'); this.css('padding', '0'); this.css('border', '0'); return this.animate({ height : hide , opacity : 0.1 } , 500); }; $.fn['_fadeIn'] = function(){ this.css('overflow', ''); this.css('padding', ''); this.css('border', ''); return this.animate({ height : show , opacity : 1 } , 500); }; However, as you seen, I will have a short animation unsmoothly, can you give me some more suggestion? Thank you very much! Sorry for my Bad English!
[jQuery] append()-Param containing script
Hey there, I'm trying to append HTML code to a DOM element, with a string that also contains a script tag: input type=text id=foo script type=text/javascript stylizeInput($('input#foo')); /script It works fine, just like it should according to jQuery functionality. The crucial thing is: The script is being processed too fast, therefore executed before the input field is known. How can I delay execution until the HTML part is fully loaded? $('input#foo').ready() won't work and I don't consider setTimeout as a solution. Thanks for your help Eric
[jQuery] Re: Conflict between Simplemodal and jquery-ui slider?
The problem is that you are including the basic.js file from my site, which is causing a conflict. Remove that script and use the following code: $(document).ready(function() { $('#basic-modal input.basic, #basic-modal a.basic').click(function (e) { e.preventDefault(); $('#basic-modal-content').modal({onShow: function (d) { $(#slider-vertical, d.container[0]).slider({ orientation: vertical, range: min, min: 50, max: 300, value: 100, slide: function(event, ui) { $(#amount).val(ui.value); } }); }}); }); }); -Eric On Sep 11, 7:54 pm, folder123 kjau...@gmail.com wrote: The behavior i'm seeing is the onShow only seems to run once. On subsequent modal window opens the contents in onShow don't seem to execute. -k On Sep 11, 7:31 pm, folder123 kjau...@gmail.com wrote: I'm still having issues with the code below, the slider now doesn't even show up on a 2nd window open. Any thoughts greatly appreciated, I'm sure i'm missing something simple. -k On Sep 11, 2:52 pm, Eric Martin emarti...@gmail.com wrote: Use the onShow callback inSimpleModalto call the slider init code: $('#basic-modal-content').modal({onShow: function (dialog) { $(#slider-vertical, dialog.container[0]).slider({ orientation: vertical, range: min, min: 50, max: 300, value: 100, slide: function(event, ui) { $(#amount).val(ui.value); } }); }}); -Eric On Sep 10, 2:30 pm, folder123 kjau...@gmail.com wrote: Summary - Slider does not work inSimpleModalwindow after more than once. Detail: Step 1: Click to open modal window Step 2: Observe slider working properly, with value being updated, close modal Step 3: Click to open modal window Step 4: Observe slider NOT working properly, NaN being returned If you open the modal with the slider, then close the window, then re- open the modal and attempt to move the slider NaN errors occur. Attached is a simple html document that demonstrates the problem. This has also been posted to theSimpleModalgoogle code group. Any thoughts would be greatly appreciated, thanks for all the hard work on jquery. To replicate, please cut and paste the following into a html document. html xmlns=http://www.w3.org/1999/xhtml; head link type=text/css href=http://jqueryui.com/latest/themes/base/ui.all.css; rel=stylesheet / script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js; type=text/javascript/script script src=http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery- ui.min.js type=text/javascript/script script src='http://www.ericmmartin.com/simplemodal/js/jquery.simplemodal.js' type='text/javascript'/script script src='http://www.ericmmartin.com/simplemodal/js/basic.js' type='text/javascript'/script link type='text/css' href='http://www.ericmmartin.com/simplemodal/css/basic.css' rel='stylesheet' media='screen' / script type=text/javascript $().ready(function() { $('#basic-modal input.basic, #basic-modal a.basic').click(function (e) { e.preventDefault(); $('#basic-modal-content').modal(); }); $(function() { $(#slider-vertical).slider({ orientation: vertical, range: min, min: 50, max: 300, value: 100, slide: function(event, ui) { $(#amount).val(ui.value); } }); }); }); /script /head body div id=basic-modal-content input type=text id=amount style=border:0; color:#ff; font- weight:bold; width: 40px; background: #aa; / div id=slider-vertical style=height:200px;/div /div div id='basic-modal' h2Basic Modal Dialog/h2 form action='download/' method='post' input type='button' name='basic' value='Show modal' class='basic demo'/ /form /div /body- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: SimpleModal Contact Form and Sidebar
Trent, I'm not quite sure what you are asking. Could you clarify your question? Thanks, Eric On Sep 12, 7:48 am, Trent 26g...@gmail.com wrote: How can I embedSimpleModalContact Formhttp://www.ericmmartin.com/projects/simplemodal/ in the sidebar, whose position is fixed on the scrolling map. No reference as in the example from the author: div id='contact-form'a href='#' class='contact'Demo/a a picture button.gif Code sidebar: div id=contact-form style=background: rgb(27, 27, 27); position: fixed; top: 136px; width: 25px; height: 119px; z-index: 8765; cursor: pointer; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; right: 0pt;img src=images/button.gif alt=contact width=28 height=137 //div Menu takes the following form:http://www.askdev.ru/uploads/4aa/b616/4b612e/large.gif
[jQuery] Re: Simple Modal Height and Width
As long as the content being used in the modal has a height and width supplied, SimpleModal will use those values to size the dialog. For example, using the basic demo as a base and given the following: img src=image.jpg style=display:none; height=400 width=600 id=basic-modal-content/ CSS: #simplemodal-overlay {background-color:#000; cursor:wait;} #simplemodal-container {color:#bbb; background-color:#333; border:4px solid #444;} #simplemodal-container a.modalCloseImg {background:url(../img/basic/ x.png) no-repeat; width:25px; height:29px; display:inline; z-index: 3200; position:absolute; top:-15px; right:-16px; cursor:pointer;} JS: $('#basic-modal-content').modal(); I get a the image with a border and the dimensions at 400x600. Hope that helps. -Eric On Sep 9, 12:47 pm, Byron Matto bma...@gmail.com wrote: Question: Simple Modal has default height and width values of 200 and 300 pixels respectively. Is there a way to the modal conform to whatever content is present. In other words I want the modal to have height and width equal to the HxW of image modal is applied to ... automatically. Thoughts?
[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 war...@transfusionmedia.com 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: unblockUI() problems in IE
Try the code as bellow: $.unblockUI(); $(.blockUI).fadeOut(slow); -- The code can fix unBlockUI which problem with IE6/7/8 On Sep 4, 1:38 am, Matthew Abbott dduck1...@gmail.com wrote: Im using the blockUI() plugin in jquery and I attached a click event to a button to call the unblockUI(). What it does is make the content of the block disappear, but the block and the modal background still are visible. This is only happening in IE. Im using IE7 currently. Firefox is fine. Any help is appreciated. -Matthew
[jQuery] Re: Conflict between Simplemodal and jquery-ui slider?
Use the onShow callback in SimpleModal to call the slider init code: $('#basic-modal-content').modal({onShow: function (dialog) { $(#slider-vertical, dialog.container[0]).slider({ orientation: vertical, range: min, min: 50, max: 300, value: 100, slide: function(event, ui) { $(#amount).val(ui.value); } }); }}); -Eric On Sep 10, 2:30 pm, folder123 kjau...@gmail.com wrote: Summary - Slider does not work in SimpleModal window after more than once. Detail: Step 1: Click to open modal window Step 2: Observe slider working properly, with value being updated, close modal Step 3: Click to open modal window Step 4: Observe slider NOT working properly, NaN being returned If you open the modal with the slider, then close the window, then re- open the modal and attempt to move the slider NaN errors occur. Attached is a simple html document that demonstrates the problem. This has also been posted to the SimpleModal google code group. Any thoughts would be greatly appreciated, thanks for all the hard work on jquery. To replicate, please cut and paste the following into a html document. html xmlns=http://www.w3.org/1999/xhtml; head link type=text/css href=http://jqueryui.com/latest/themes/base/ui.all.css; rel=stylesheet / script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js; type=text/javascript/script script src=http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery- ui.min.js type=text/javascript/script script src='http://www.ericmmartin.com/simplemodal/js/jquery.simplemodal.js' type='text/javascript'/script script src='http://www.ericmmartin.com/simplemodal/js/basic.js' type='text/javascript'/script link type='text/css' href='http://www.ericmmartin.com/simplemodal/css/basic.css' rel='stylesheet' media='screen' / script type=text/javascript $().ready(function() { $('#basic-modal input.basic, #basic-modal a.basic').click(function (e) { e.preventDefault(); $('#basic-modal-content').modal(); }); $(function() { $(#slider-vertical).slider({ orientation: vertical, range: min, min: 50, max: 300, value: 100, slide: function(event, ui) { $(#amount).val(ui.value); } }); }); }); /script /head body div id=basic-modal-content input type=text id=amount style=border:0; color:#ff; font- weight:bold; width: 40px; background: #aa; / div id=slider-vertical style=height:200px;/div /div div id='basic-modal' h2Basic Modal Dialog/h2 form action='download/' method='post' input type='button' name='basic' value='Show modal' class='basic demo'/ /form /div /body
[jQuery] Re: simpleModal question. PLEASE HELP!
David, The problem is being caused by the data you are trying to place in the modal. You can fix it by wrapping the data in a div before using it in the modal: $(document).ready(function() { [snip] $.get(form.cfm, function(data){ // create a modal dialog with the data var d = $(div/div).append(data); $(d).modal({ [snip] }); -Eric On Sep 9, 11:17 am, David Garthe davidgar...@gmail.com wrote: Hi, I hope someone is familiar with simpleModal. I'm trying to add some effects to the popup, but keep getting errors when I add my onOpen parameter. Here's my code. Thank! $(document).ready(function() { $('#create-user').click(function(e) { e.preventDefault(); // load the contact form using ajax $.get(form.cfm, function(data){ // create a modal dialog with the data $(data).modal({ overlay:80, overlayCss: {backgroundColor:#cc}, overlayClose: true, position: [e.pageY,e.pageX], onOpen: function(dialog) { dialog.overlay.fadeIn('fast', function() { dialog.data.hide(); dialog.container.fadeIn('fast', function() { dialog.data.slideDown('fast'); }); }); } }); }); }); });
[jQuery] Re: Check if function exists
unsubscribe me Eric Paige Web Developer On Wed, Sep 2, 2009 at 10:44 AM, shapper mdmo...@gmail.com wrote: Hello, I am loading TinyMCE using the new JQuery Plugin: script type=text/javascript $().ready(function() { $('textarea.tinymce').tinymce({ // Location of TinyMCE script script_url : '../js/tinymce/jscripts/tiny_mce/tiny_mce.js', Is there a way to load only if tinymce plugin is present without getting an error? Basically if I don't want to load the tinymce I just don't load the plugin ... ... Because I am not able to pass, I think, to my SiteScript.JS file if I want to load or not the plugin. Thanks, Miguel
[jQuery] Looking to sell a jQuery Conference (Boston) ticket
Hello, I have a ticket for the jQuery conference in Boston in two weeks that I'm not going to be able to use. I'm looking to sell it for $150 (original ticket price). Please contact me if you're intersted. Thanks.
[jQuery] Re: JqModal / simpleModal - maintaining form state
If you are referring to the known issues I mentioned - since they are browser issues, Eric, thanks for the response. What issues did you mention that I missed? http://www.ericmmartin.com/projects/simplemodal_v12/#othernotes [under Known Issues] you'd need to implement something that woul keep track of state in those browsers. What code have you used for this? Just copy all values into an array on close and reset on open? I haven't had the need to solve this problem, so I don't have any code to share. So, you'd need to write something to save the state of radio buttons in both IE6 and IE7 and checkboxes in IE6. -Eric
[jQuery] Re: Looking to sell a jQuery Conference (Boston) ticket
The ticket has been spoken for. On Sep 1, 11:19 am, Eric estrathme...@gmail.com wrote: Hello, I have a ticket for the jQuery conference in Boston in two weeks that I'm not going to be able to use. I'm looking to sell it for $150 (original ticket price). Please contact me if you're intersted. Thanks.
[jQuery] jQuery Conference (Boston) ticket available.
Hi, I found out I can't go to the jQuery conference in Boston on 9/12 and 9/13, so I have one ticket that I'm looking to sell for $150 (original ticket price). Please contact me if you're interested. Thanks.
[jQuery] Re: JqModal / simpleModal - maintaining form state
If you are referring to the known issues I mentioned - since they are browser issues, you'd need to implement something that woul keep track of state in those browsers. On Aug 31, 6:45 am, Steffan A. Cline stef...@hldns.com wrote: on8/30/09 12:48 PM, Steffan Cline at stef...@hldns.com wrote: I have tried both of these modal solutions, beautiful by the way, and found a small problem with both of them and am wondering if there is a work around. I have a form where there are a bunch of check boxes that I have enclosed in a div that I am using for my popup modal. Now the thing is that while the modal is up and I check a bunch of boxes and then close the modal, reopen again, all checkboxes have been reset rather than retaining their state. Is there a way to circumvent this behavior? So, if I click checkbox #1 and close the modal and then reopen the modal, checkbox #1 is no longer checked. I need it to maintain it's state. Any suggestions? Thanks Steffan I tried a couple other modal type plugins and seem to have the same issues. Has anyone seen this before? Is there a work around? Thanks Steffan --- T E L 6 0 2 . 7 9 3 . 0 0 1 4 | F A X 6 0 2 . 9 7 1 . 1 6 9 4 Steffan A. Cline stef...@execuchoice.net Phoenix, Azhttp://www.ExecuChoice.net USA AIM : SteffanC ICQ : 57234309 YAHOO : Steffan_Cline MSN : stef...@hldns.com GOOGLE: Steffan.Cline Lasso Partner Alliance Member ---
[jQuery] Re: JqModal / simpleModal - maintaining form state
With SimpleModal, you can use the persist option: $(el).modal({persist:true}); There are some known issues in IE though.[1] -Eric [1]: http://www.ericmmartin.com/projects/simplemodal_v12/#othernotes [under Known Issues] On Aug 30, 12:48 pm, Steffan A. Cline stef...@hldns.com wrote: I have tried both of these modal solutions, beautiful by the way, and found a small problem with both of them and am wondering if there is a work around. I have a form where there are a bunch of check boxes that I have enclosed in a div that I am using for my popup modal. Now the thing is that while the modal is up and I check a bunch of boxes and then close the modal, reopen again, all checkboxes have been reset rather than retaining their state. Is there a way to circumvent this behavior? So, if I click checkbox #1 and close the modal and then reopen the modal, checkbox #1 is no longer checked. I need it to maintain it's state. Any suggestions? Thanks Steffan --- T E L 6 0 2 . 7 9 3 . 0 0 1 4 | F A X 6 0 2 . 9 7 1 . 1 6 9 4 Steffan A. Cline stef...@execuchoice.net Phoenix, Azhttp://www.ExecuChoice.net USA AIM : SteffanC ICQ : 57234309 YAHOO : Steffan_Cline MSN : stef...@hldns.com GOOGLE: Steffan.Cline Lasso Partner Alliance Member ---
[jQuery] Upgrading to 1.3.2 from 1.2.6, selectors that used to return many elements now only returning first
I am not trying to upgrade to 1.3.2 and in every case I use a selector that should (used to) return many elements now only returns the first. I checked using the .size() method and it is indeed only returning 1. Any ideas on what went wrong? Thanks, Eric
[jQuery] Re: SimpleModal autoresize on demand?
Vru, The actual code would depend on exactly what you are trying to do, but taking the onShow callback function test[1], I modified the code to resize and reposition the container: function modalShow (dialog) { var self = this; dialog.data.find('input.animate').one('click', function () { dialog.container.animate({height:+=50, width:+=50}, 1000, function () { self.setPosition(); }); }); } [1]: http://www.ericmmartin.com/simplemodal-test/ Hope that helps. -Eric On Aug 26, 7:52 pm, Veeru swamyve...@gmail.com wrote: Hi there, I have been using simpleModal Was wondering if there is a way to resize simplemodal on demand; in other words; i would like to change the height/width of simple modal when the content has changed. As of now, if the content has changed and grown, it overflows the simplemodal dialog. Any suggestions? Thanks Vru
[jQuery] Re: Simplemodal is triggering $(document).ready
Luis, Can you be a little more clear on what the problem is? Do you have a link or sample (working) code I can see? -Eric On Aug 23, 6:55 am, lfrodrigues lfrodrig...@gmail.com wrote: Hi, I've been using simple modal for quite some time. Now I have a problem. I have some code with uses $(document).ready and simplemodal. The problem is I have 3 $(document).ready calls: 1-when page is loaded 2-when simple modal shows the overlay 3-when simple modal hides the overlay How can I prevent simple modal from triggering the events? Regards, luis
[jQuery] jQuery Twitter Full API Plugin - Help Needed Testing
Hey guys, I've been working on a full implementation of the twitter API through, primarily, jQuery, with a simple relay script server side for securely signing and keeping auth details. I've just finished the library, and am looking for some developers who know either the twitter API and jQuery to help test out this new plugin. If you would like to help with this project (currently named Jitter: Jquery Twitter), please send an email to gars...@gmail.com Thanks! [Cross Posted on the Twitter Dev and jQuery Lists]
[jQuery] Re: Simplemodal ajax dialog
Michael, You need to initialize any third party scripts in the SimpleModal onShow callback. Here's an example of using Datepicker with SimpleModal: http://www.ericmmartin.com/code/datepicker/ -Eric On Aug 7, 2:34 am, Michael Anckaert michael.ancka...@gmail.com wrote: Hello everyone, Using the simplemodal plugin I create a dialog dynamically from links using $(.dialog-link).live('click', function(e) { e.preventDefault(); $.get($(this).attr('href'),function(data) { $.modal(data, {onOpen: open, position: ['10%','30%']}); }); }); (FYI: the onOpen callback just sets some height) The document returned by the ajax call (contained in data) has some jquery calls to datepicker, etc. But when my dialog displays the datepicker won't work. As far as I can tell the javascript in the document called with AJAX isn't executed, but I do get my alert() test statements... Does anyone know where my error lies? Thanks, Michael
[jQuery] Re: Remove an element but not it's content
If you want a cleaner look, you can always just throw together a quick plugin to handle things: $.unwrap = function(){ return this.each(function(){ var el = $(this); el.before( el.html() ).remove(); }) } Then, simply call: $('a.tester').unwrap(); And it will unwrap all matching tags. On Aug 6, 2:10 pm, piter piotrek.fr...@gmail.com wrote: Hi, Not sure if sent the post but Solution is quite easy (I wouldnt even use jQuery for this): For re-use purposes create function: function rmTags(ref){ ref.parentNode.insertBefore( document.createTextNode (ref.innerHTML), ref); return ref.parentNode.removeChild(ref); } get reference to Your link, (however You want, jQuery etc.) and invoke function on it; rmTags( $(theLink) ); cheers ps. not sure if previous was sent so if it's repeated just delete it.
[jQuery] Re: Loading jQuery without blocking
Honestly, I'd load jQuery regularly, and use the getScript function to load the rest of the files after domready. I don't know that you're getting a big performance increase in loading the jquery library in this method, and it is causing an unknown error, which isn't an ideal thing to debug. :P Using jQuery to backload any additional plugins or scripts can be super useful, but including the jQuery library asynchronously seems like a poor decision. On Aug 6, 4:12 am, north ollo...@web.de wrote: Hi all, I played around with Steve Souders' techniques of loading JS without blocking a bit (I had already been using jQuery's getScript/ajax to load bigger chunks of code for certain parts of the site only if necessary). I tried to use what Nicolas Zakas calls the best way to load JS (http://www.nczonline.net/blog/2009/07/28/the-best-way-to-load- external-javascript/) for the project I work on. I created the script... tag for jquery.js the way described in the article, and then tried to use onload/readystate to start loading the file with my plugins/functions right after jquery did. This seems to work fine in all browsers except, you guessed it, IE... For some reason IE (I think it happened in 6, 7 and 8) throws me an unknown error every now and then. It's just a guess, since an unknown error doesn't really help me debugging, but maybe sometimes the plugin/functions file finishes loading before jquery. Even though that should be prevented by checking the readystate... I tried several other approaches then (like adding an ajax call to the plugins/functions file at the end of the jquery file, or checking for (typeof jQuery == 'undefined') in a loop to try loading the files as soon as this statement equals false), but none would work. Is anybody using one of these non-blocking techniques with jQuery successfully? Thanks
[jQuery] Re: More fun with decrementing on click
The problem is in how you're applying the decrement operator. If you put it at the end of the number, as in: number-- Then, the current number will be returned, THEN decremented. That's what's happening here. Simply put the operator before the number, so it is decremented THEN returned. $('.number').html( --count ); On Aug 3, 4:15 pm, littlerobothead nickmjo...@gmail.com wrote: I have a status area in an app I'm working on. It shows the number of unread alerts. As the user clicks each alert, it's subtracted from the total. The following code counts the number of items to use as my total: var trigger = $(#dataset-b tr.unread); var count = $(trigger).length; $(.number).html(count); And then this works to subtract from that number on each click: $(trigger).click(function(){ $(.number).html(count--); if (count == 0){ $(trigger).unbind(click); } $(this).removeClass('unread'); }); Problem is, nothing happens on the first click. However, on the second click my number starts to decrement. What's going on here? How can I make the count work? Best, Nick
[jQuery] Re: Loading a Page in an Iframe with BlockUI
Chris, Regarding SimpleModal, wouldn't this accomplish what you are looking for? $.modal('iframe src=http://www.ericmmartin.com; id=iframeTest name=iframeTest height=450 width=830 style=border:0 /', { closeHTML:, overlayClose:true, containerCss: {height:450, width:830} }); That's with SimpleModal v1.3. -Eric On Jul 29, 7:24 am, Chris chriss...@gmail.com wrote: How would you load a separate page in an iframe with BlockUI? I tried: forceIframe:true, iframeSrc:'/iframepage.html' but BlockUI still creates the default Please wait... overlay, but also creates a seemingly separate iframe overlay, but without applying any of the CSS properties to it. If BlockUI doesn't have this functionality, so any of the other overlay plugins support it? I've tried jqModal and SimpleModal, but none of them seem to explicitly support this. Regards, Chris
[jQuery] Re: function running 2X
Pretty sure its because the event is bubbling up. Try: $('#cardcharges td').click(function(){ alert('execute once'); return false; }); On Jul 29, 2:38 pm, marksimon zen...@gmail.com wrote: no stupid ideas here, but changing to $(#cardcharges td).click( didn't fix the problem. On Jul 29, 11:22 am, András Csányi sayusi.a...@gmail.com wrote: 2009/7/29 marksimon zen...@gmail.com: Any idea why this would run twice: function clickcharges() { $('#cardcharges tr td').click(function() { alert('execute once'); }); } Stupid idea, but maybe... Because the td tag is part of the tr. And if you click the cell once means that one click on the cell and one click on the row... :) -- - - -- Csanyi Andras --http://sayusi.hu--Sayusi Ando -- Bízzál Istenben és tartsd szárazon a puskaport!.-- Cromwell
[jQuery] Re: simplemodal scroll problems
Do you have a link? Can you disable the scroll in the page. If not, how about disabling it in the modal: $(element).modal({onShow: function (d) { d.wrap.css('overflow','hidden'); }}); -Eric On Jul 29, 8:44 am, junkqwe urize...@gmail.com wrote: I am using simplemodal 1.3 my modal shows a product description. the description text is long and doesnt fit the modal without scrolls the problem is that both the page and the mpdal has scrolls and it looks very bad. anyone came across this problem? or maybe have a modal solution for jquery to solve this problem? many thanks
[jQuery] Re: consistently unable to get return false to work, why?
Try starting off with a simplifying your selectors and the code in general? .live(), in this case, isn't going to provide you much benefit, as you're binding it to an element based on an ID, which means there will only ever be a single element which this function triggers for. Try something like: $(function(){ $('#getEmail').submit(function(){ var sid = $('.emailsButton', this).attr('id'), email = $('#email'); email.after( isValidEmailAddress( email.val() ) ? 'works' : 'label class=errorEmail is not valid!/label' ); return false; }); }); On Jul 28, 12:30 pm, pedalpete p...@hearwhere.com wrote: That is what i've always thought James, but Firebug isn't showing any errors. I had actually edited the code and removed a context when i posted, so that is why that element didn't have a closing quote. But i had been constantly changing things, and no errors. However, you are correct that I had an error in the JS in that I had gone back to using $ rather than jQuery in the script, and I think that is what was screwing this up. I still find it very strange that of the many, many times i've used 'return false', i almost never get it to work the first time, and usually, i don't see what I've changed to make it work. Thanks for the help. Pete On Jul 27, 3:50 pm, James james.gp@gmail.com wrote: If the return false fails, it's usually something wrong with parsing your Javascript that causes the problem. For example: $(input#email).after(works); It's missing a closing quote () after email. On Jul 27, 12:28 pm, pedalpete p...@hearwhere.com wrote: Thanks John, I wasn't familiar with the .live() before, but of course I'll use that where I can. Though I'm honoured and humbled by your response, unfortunately, in this case, I'm using a 'submit', and the documentation says i can't use .live on submit currently. (I did try and, and it didn't work). .bind doesn't seem as efficient, as I'll be regularly binding/ unbinding, but I've added that anyway, and still after the alerts, the form submits. As the form itself is created on the fly, i've put the bind inside the function which creates the form, and unbind before the form is first created so that i'm not stuck with the old data. Unfortunately, i'm still stuck with the original problem, return false; appears to be ignored. On Jul 27, 2:14 pm, John Resig jere...@gmail.com wrote: It looks like you're using the old liveQuery plugin. Why not just use .bind() or .live()? --John On Mon, Jul 27, 2009 at 5:11 PM, pedalpete p...@hearwhere.com wrote: So, this isn't related to any one bit of code, but it seems to be a problem I run into almost everytime i need to stop a form or link for doing what it was originally intended to do (submit). Now, i have used return false; many times, but it never works at first. I'm never sure what I end up changing, but something changes, and then all of a sudden it works, and I am once again left stumped as to what I did. Yesterday, i renamed a class, and all of a sudden, it worked. Changed the class back, and guess what! It still works, though it hadn't before ...r Today, i'm trying to use a submit, check the e-mail address and then submit the form via ajax. Once again, i can't seem to stop the form from submitting. There are no other javascript errors coming up in firefox. my alerts work, so i'm in the right function, but then...the form submits. code jQuery('div#selected form#getEmail').livequery('submit', function (){ var sid=jQuery('input.emailsButton', this).attr('id'); var emailAddress=jQuery('input#email', this).val(); alert(sid); if(isValidEmailAddress(emailAddress)) { alert('works'); $(input#email).after(works); } else { alert('errored'); $(input#email, this).after(label class='error'Email is not valid!/label); } return false; }); /code I've tried moving the return false; into the if/else, but no changes. As mentioned, i think the biggest problem isn't just with this code. There is something I seem to be doing consistently. Thanks
[jQuery] Re: Using replaceWith on a div / instead of a div/div causes text to be deleted
The W3C has a list of valid self-closing tags, div of which is not one of them (for the sake of compatibility, I think). http://www.w3schools.com/xhtml/xhtml_ref_byfunc.asp Only the following tags should be self closed: area / base / basefont / br / hr / input / img / link / meta / On Jul 28, 11:30 am, thorasm...@gmail.com thorasm...@gmail.com wrote: Not sure whether this is a bug, but is is certainly unexpected behaviour. When i try to use replaceWith on a div / instead of a div/div (which is correct HTML syntax) it causes, not only the div but all code after the div to be replaced. Please see the code here: http://nafai.org/temp/jqueryproblem/ I will make a bug report if others also think this is a bug.
[jQuery] Re: JQuery and XHTML in Firefox
What doctype / mimetype are you specifying. If you're doing xhtml+xml, I'm pretty sure if you remove the +xml portion, things will play nicely again. On Jul 28, 12:55 pm, ScottSEA william.scott.ba...@gmail.com wrote: Until recently, I was humming along happily with my jQuery and HTML... life was good. Sadly, the Powers That Be have ordained that Thou Shalt Useth XHTML - so let it be done. I've undergone the process to convert to XHTML - all is valid and all is well... but no. Firefox treats XHTML as XML. jQuery is designed for HTML - when appending / prepending / removing it uses the innerHTML () function, which of course doesn't work for XML/XHTML. Lest you despair, there is indeed a question in here. Does anyone have a recommendation for using XHTML and jQuery? I'm not overly excited about writing my own plugin, so if someone has already done the heavy lifting, could you point me in the right direction?
[jQuery] Re: JQuery and XHTML in Firefox
Can you give a sample of the output? How different is the result of the transform from valid xhtml? On Jul 28, 2:55 pm, ScottSEA william.scott.ba...@gmail.com wrote: On Jul 28, 9:55 am, ScottSEA william.scott.ba...@gmail.com wrote: Until recently, I was humming along happily with my jQuery and HTML... life was good. Sadly, the Powers That Be have ordained that Thou Shalt Useth XHTML - so let it be done. I've undergone the process to convert to XHTML - all is valid and all is well... but no. Firefox treats XHTML as XML. jQuery is designed for HTML - when appending / prepending / removing it uses the innerHTML () function, which of course doesn't work for XML/XHTML. Lest you despair, there is indeed a question in here. Does anyone have a recommendation for using XHTML and jQuery? I'm not overly excited about writing my own plugin, so if someone has already done the heavy lifting, could you point me in the right direction? Serious omission on my part: These are all *local* .xml files that are transformed by stylesheets to render xhtml. Ergo, no specifying of doctype, mimetype, no server, nuttin'. Just local files - and the xsl:output method='xml' is the problem. If I change it to HTML, then everything works fine - but it's no longer XHTML. The three options are text, xml or html - xhtml is not a valid choice.
[jQuery] Re: Using data(name,value) to store additional information
You could also do it with non-styling classes, as an alternative to locating them. $('div:first').data('foo', 'bar').addClass('foo'); $('.foo'); On Jul 28, 3:15 pm, Basdub dube.sebast...@gmail.com wrote: Thanks, that should do the trick. On Jul 23, 10:44 pm, Karl Swedberg k...@englishrules.com wrote: One way to retrieve them is to use the .filter() method with a function. for example: $('div').filter(function() { return $(this).data('foo') == 'bar'; }); --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Jul 21, 2009, at 11:29 AM, Basdub wrote: I wanted to define additional attribute to a tag to manage information. I realized that XHTML might not like it and discovered the data(name,value) function. I was wondering how i could retrieve all tags e.g. div that have that data variable set.
[jQuery] Re: Looking for some help converting this to jquery
function setButtonClass(){ $(':submit,:reset,:button').each(function(){ var el = $(this), val = el.val(), word = (val.split(/[^A-Z\W]/).length/2) + val.length; el.addClass( word = 12 ? 'mb' : (word 4 ? 'sb' : (word 0 ? 'b' : '')) ); }) } Untested, but give it a shot. Should work fine, so long as you execute after document.ready. On Jul 23, 12:38 pm, sleepwalker danielpaulr...@gmail.com wrote: Thanks Rob I like your approach and learned a lot. This is why I like to post code to see how others attack the same issue. I would still like to see how someone would code this using the jquery syntax rather then the standard javascript way, so if anyone wants to give it a go please do. All us newbies learn a lot from this stuff so thanks again. Daniel
[jQuery] Re: Make width of inner div equal outer
$('.secondLevel').css('width', $('#header').width()); On Jul 23, 1:16 pm, Paul Collins pauldcoll...@gmail.com wrote: Hi all, I've got a problem with IE6 and I need to basically find the width of the header DIV and make the secondLevel DIV match it. So, I guess I need to target IE6 specifically in the code. Here's what I have: div id=header ul id=topNavigation lia href=/Home/a/li li class=selected a href=/About Us/a div class=secondLevel ul lia href=/Overview/a/li /ul /div /li lia href=/Contact/a/li /ul /div I'm not sure how to start with the script. I can calculate the width of the header DIV, but not sure how to force the secondLevel one to match it. alert($(#header).width()); Any help would be fantastic. Cheers Paul
[jQuery] Re: Binding of object
In what situation in your code would more than a single event be bound to the element? On Jul 21, 11:22 am, Liam Potter radioactiv...@gmail.com wrote: Well the way you do it would really do anything, it will just unbind, then run the function again as it is chained? sken wrote: Would make sense but i think i go with my unbind solution ... thanx for your help.
[jQuery] Re: error jquery-1.3.2.js(line 3633)
Well, firebug shouldn't have cared as much as IE would, because of a comma inside the list of params in your POST. The last element in an object can't have a comma. Also, could you post the HTML? On Jul 6, 8:49 am, Mark johanns.m...@gmail.com wrote: I have 3 drop down menu's where is post the value's bij a button.click (see code below). But when i push the button i see an error in fire bug POSThttp://localhost/agendanieuw/handler.php 67ms jquery-1.3.2.js(line 3633) I looked online for awnsers but couldn't find any. Maybe you guys can help me. Here is my js code. script type=text/javascript src=jquery-1.3.2.js/ script script type=text/ javascript $(document).ready(function() { $(button).click(function() { $.post('handler.php', { jaar:$('#jaar').val(),//jaar means year maand:$('#maand').val(),//maand means month week:$('#week').val(), }) }); }); /script
[jQuery] Re: Create an AJAX form within a modal window.
I'm not familiar with CF - so I'm not sure if it handles forms differently (link .NET), but you should be able to use the onShow callback to bind the form submit and handle it accordingly. Check out the Contact Form demo[1] for an example. -Eric [1] http://www.ericmmartin.com/simplemodal On Jun 29, 11:45 am, Erich93063 erich93...@gmail.com wrote: I am creating an admin in ColdFusion and am trying to add a feature where when the user clicks the edit button for something, a modal window will pop up which contains a form (loaded from an external file) that when the user submits it, it's an AJAX submit and then the modal window closes and fires off a function that updates the display page. I am using SimpleModal http://www.ericmmartin.com/simplemodal/ and I managed to load an external form file into the modal window using $.get but then I can't figure out how to get that form that loads in the modal window to submit via AJAX instead of the default form post that happens. I need to submit their data via AJAX and then if successful, close the window and do the update function on the display. Has anyone already done this?
[jQuery] Re: check/uncheck all checkboxes with specific id
Is there a particular reason you couldn't use classes to do this? Instead of the markup you provided, something like: input type=checkbox value=EventAcceleratedOptionVesting id=chkEventAcceleratedOptionVesting class=chkEvent / input type=checkbox value=AccountingChanges id=chkEventAccountingChanges class=chkEvent / Then: // Use the :checkbox instead of the old method you're using $(':checkbox.chkEvent').each(funciton(){ var el = $(this); el.attr('checked', el.is(':checked') ? '' : 'checked'); }) Would do what you're asking. If you insist on doing it with the IDs, you can always just substr: if ($(this).attr('id').substr(0, 8) == 'chkEvent') ... But this method is far less efficient, and you'll be double-looping through the tree section (once for jQuery to build an indiscriminate collection of the nodes, then once again by your code to discriminate the nodes and apply the check/uncheck effect) On Jun 30, 12:38 pm, evanbu...@gmail.com evanbu...@gmail.com wrote: I want to check all of my checkboxes in my form that have an id that begins with 'chkEvent'. Thanks script language=Javascript type=text/javascript $(document).ready(function() { $(#toggleEvents).click(function(event){ $('inp...@type=checkbox]').each( function() { // Begin this is where I am lost if($(this).id()=='chkEvent*') // End this where I am lost this.checked = !this.checked; }); });}); /script a href=# id=toggleEventsToggle Events/a form method=post action= input type=checkbox value=EventAcceleratedOptionVesting id=chkEventAcceleratedOptionVesting / input type=checkbox value=AccountingChanges id=chkEventAccountingChanges / input type=checkbox value=AnnualMeetingChanged id=chkEventAnnualMeetingChanged / input type=checkbox value=AssetSalePurchase id=chkEventAssetSalePurchase / input type=checkbox value=AuditorChange id=chkEventAuditorChange / /form
[jQuery] Re: Traversing not
Please provide the markup you're using that works for anchors and not imgs. On Jun 30, 8:58 am, Luciano lucianoffra...@gmail.com wrote: I'm trying to use the function Not (): when I run the command on the TAG A and works $ (this). find ( a). not ( '[href ^=/]'). attr ( target, ) when I run the command on the tag IMG not working $ (this). find ( img). not ( '[src ^=/]'). attr ( target, ) what may be happening?
[jQuery] Re: how to ask questions
If you need a place to host code for demonstration (because you're working offline, or need to expose only a fragment of code you can't get working), you have the BEST chance of getting an answer by posting your code on http://jsbin.com and dropping in a link. When people come in and post hundreds of line of code with often vague descriptions as to what they need help doing, I'm less inclined to finish reading and provide any kind of helpful information, because they've made it nearly impossible for me to do anything in a realistic amount of time to help them. If you really just isolate what you can't get working and provide a link to a live demonstration, chances of your question getting answered increase pretty dramatically. On Jun 26, 10:20 am, amuhlou amysch...@gmail.com wrote: not to mention sometimes you figure out the problem by creating a test case. On Jun 26, 10:05 am, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: shaded wrote: its not always practical to post a link. The stuff im working on is offline for now. including database and php files. but thanks for all the tips. You don't always have to post your whole site, you could reduce it to a testcase. Just show the minimal amount of html and javascript that exhibits the problem you have. Chances are you'll find the root of your problem while you're working on the testcase. Jonathan -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be
[jQuery] Re: Problem with double submit of and form
Your code is confusing. Why do you have the script tag wrapped inside of the form element? Why do you have two script tags a couple tags away from each other instead of inside your header definition? Your script is chock full of errors. Here's a couple of suggestions: 1. Move both of your script tags to inside the head of your document. 2. Don't define two document.ready events like you are. It's inefficient for the sake of. 3. Your form has an ID, yet you reference it by trying to find it as a child of the parent. Instead of $('#tpcsubmit').closest(form).submit(function() { Try $('#teilprojekt_create).submit(function() { 4. There's no need to declare the optionstpcsubmit variable like you are. For a couple reasons: 4a. You're defining references to functions before they exist! You have beforeSubmit being set to a function reference for before_tpcsubmit, but that function isn't defined to later inside the script, meaning it's undefined. 4b. You can easily solve all your problems by restructuring your code to put the object directly inside the plugin call. (This will solve the functions being undefined thing as well). $(this).ajaxSubmit({ beforeSubmit: before_tpcsubmit, success: complete_tpcsubmit, timeout: 3000, target:'#target' }); 5. Along the same vein as #4, you're declaring functions unnecessarily. You could be doing a lot better by using lambda functions. $(this).ajaxSubmit({ beforeSubmit: function() { $('#inicator').show(); } , success: function() { $('#inicator').hide(); $(#target).effect(slide,{ },2000); }, timeout: 3000, target: '#target' }); 6. Calling javascript:void(0) is, imo, pretty archaic, especially with jQuery at your disposal. Make the href=#, then just restructure your click event to the following: $('#testlink').click(function(){ $(#tpanlegen).effect(slide,{}, 2000); }); 7. Try to use some kind of human-readable naming schema. itsnoteasytoreadavariablewheneverythingisjustcrammedinthere. (ItsWayEasierToReadAVariableIfYouCamelCaseIt) 8. Don't make variable names as long as the previous example. Remember, with javascript, size matters. The smaller your file, the faster it can be transmitted. The less meaningless declarations and scruff code you have, the easier it will be to maintain. On Jun 26, 9:46 am, fredrik carl.fredrik.bonan...@gmail.com wrote: Hum, sorry not on top of my head. I'll try your code when I get home. ..fredrik On Jun 24, 6:39 pm, jogep joh...@googlemail.com wrote: when I try your code the form will still executed twice. The Alert tells me 1 closest form . Any other Idea? Thank You Johannes - web:http://www.jgeppert.com twitter:http://twitter.com/jogep On 24 Jun., 16:01, fredrik carl.fredrik.bonan...@gmail.com wrote: What happens when you tie the event to the form instead of the submit button: $('#teilprojekt_create').submit(function(e) { e.preventDefault(); $(this).ajaxSubmit(optionstpcsubmit); }); If that doesn't work, see what the length of $('#tpcsubmit').closest (form) is. console.log($('#tpcsubmit').closest(form).length)) or alert($('#tpcsubmit').closest(form).length) ..fredrik On Jun 24, 3:47 pm, jogep joh...@googlemail.com wrote: thanks for fast response. Sorry but the form was still executed twice. Best Regards Johannes Geppert - web:http://www.jgeppert.com twitter:http://twitter.com/jogep
[jQuery] Re: extract data from this JSON encode using jQuery
Well, lets assume you're getting the JSON you described from the following ajax call: $.post('/path/to/json.php', {params: 'go here, if you need them'}, function(data){ // data contains that JSON object you described // Also, I'm assuming your select box looks something like this: // select id=mySelectBox/select var select = $('#mySelectBox'); if (data.length) $.each(data, function(){ $( 'option value=' + this.State.name + '' + this.State.name + '/option').appendTo( select ); }) }, 'json'); On Jun 26, 6:46 am, liaogz82 liaog...@gmail.com wrote: Hi all, I have this JSON file that does the encoding from the states database. I want to extract it out using jquery and populate the select drop down box. the json file is being encoded in this way: [ {State:{name:AUSTRALIA CAPITAL TERRITORY}}, {State:{name:NEW SOUTH WALES}}, {State:{name:NORTHERN TERRITORY}}, {State:{name:QUEENSLAND}}, {State:{name:SOUTH AUSTRALIA}}, {State:{name:TASMANIA}}, {State:{name:VICTORIA}}, {State:{name:Western Australia}} ] not very sure how to extract out the values. Please help me. Thanks!
[jQuery] Re: Optimize object random generator
I put together a plugin to handle this kind of thing that does okay in most browsers, called replicator. Give that a shot and see if it helps making your life any easier. http://eric.garside.name/docs.html?p=replicator On Jun 26, 10:11 am, chronotype thund3rb...@gmail.com wrote: Hello, i've created a function to generate user defined number of an image. I'm sure that it's not the optimal solution, because over 100 elements most browsers renders it very slow... Here is the sample page:http://resolution.capsule.hu/(the × image is randomly generated) The js function: function exRandomizer(param,maxDim,transp) { var x = $('body').width() - maxDim; var y = $('body').height() - maxDim; for ( var i = 0; i param; i++ ) { var dim = Math.round(Math.random() * maxDim); $('#container').before('img src=static/images/ex.gif alt= class=eX id=eX_' + i + ' /'); $('#eX_' + i) .css({ opacity: transp, zIndex: 1, top: Math.round(Math.random() * y) + 'px', left: Math.round(Math.random() * x) + 'px', width: dim + 'px', height: dim + 'px' }); } return false; } and you can call it for example: exRandomizer(100,250,0.1); I would be very happy, if someone could post a more optimal version - it's very useful, and I think many of beginner jquery users could learn a lot form an example. Thanks in forth! { csongor }
[jQuery] Re: call a method outside a jquery object
Long story short, you can't do what you're trying to do. You have some massive scoping issues. first, anything within you document.ready function (as defined by $(funciton(){..});) that gets declared in there is accessible only inside that function itself. Now, I'm not sure what you're actually trying to accomplish here, as this example is a bit on the simple side. Could you give a broader idea of your goal? That'd help in putting you on the right direction to the best way to get this done (as if you're merely trying to echo a variable, there's way better implementations than what you've described). On Jun 26, 5:06 am, jasper saronno jakirihutim...@gmail.com wrote: Hello Everybody, I am not sure I have explained well enought what I mean. I found very difficult to call a method outside his scope. For example I have 2 files js myFunction.js init.js (where I initialize all my page) [init.js ] // JavaScript Document $(document).ready(function(){ //call getX(); }); - [myFunction.js ] // JavaScript Document $( function(){ var x = Hello world; function getX(){ alert(x); } } ); I tried many syntax in order to call the method outside its scope $.getX(); $(function(){getX()}); $().function().getX(); $(myHtmlObj).click(function(){getX()}); I really would like to understand that issue, if you also may suggest the title of a good book and the chapter that explain it I would really appreciate. Many thanks - jasper
[jQuery] Re: Protect images
Just as an FYI, you do know that if the user can see the image on your website, it's already on their computer. Not to mention, anything you do that's purely a javascript fix can be avoided by merely turning off javascript. It's essentially a fool's errand to attempt to do this. On Jun 26, 11:27 am, Mario Soto canc...@gmail.com wrote: @Jonathan Vanherpe (T T NV) Yes, some demotivational posters are son funny (some others ... not recommended). Well. Following your comment, I decided to disable right click on the div. I will use JQUERY RIGHT-CLICK PLUGIN (http:// abeautifulsite.net/notebook/68) and try to avoid the context menu for Save as... @all It's definetively a bad experience and as I said before, I know that protecting content for being downloaded is really not as efficient as anyone wants. Only with pressing Print Screen you have your image to be copied. Although this images are on an intranet, and we dont want do add a watermark, because it will make unreadable some documents (some are very, very old and pigmented). Positionate the gif is a little more complicated, that disabling context menus. Thanks to all.
[jQuery] append and *slowly* show new content in DOM
Hi, I'm guessing this is an easy question, but I can't figure it out. I want to add some new content to the DOM, so I have a line like this. $('#div_container').append('phi there!/p'); However, I'd like it to slowly appear via show(). But adding show() doesn't work as I'd expect. The new content appears instantly. $('#div_container').append('phi there!/p').show('slow'); Thanks for reading, Eric P
[jQuery] When using append() , appended content is not treated by jquery
Sorry if the subject is somewhat hard to understand, but if I had the proper terminology, I probably would have found an answer through google. So here's the problem. Within my HTML I have the following div: div id=InvoiceList p class=triggera href=#Test Entry/a/p div class=detailsTest Details/div /div And in the script, the following jquery function: $(.details).hide(); $(p.trigger).click(function(){ $(this).next(.details).slideToggle(slow,); }); This works fine, the div is hidden initially and I click to show it. Now, the problem is that if I append() a new p and div to the InvoiceList, the div is visible and clicking the link does nothing. Here is how I append: $(#InvoiceList).append(p class=\trigger\a href=\#\An Invoice/a/pdiv class=\details\Invoice Name: + varInvoiceName + Supplier: + varSupplierID + brComments: + varComments + / div); Since the append code is before the trigger functions, I would expect jquery to see the appended content of the div and apply the .hide() and .click() functions properly... But it doesn't! This seems to be a general problem with append(), as I've seen the same problem with accordion() (to which the answer was to reinitialize it, but I don't see how this would be possible with a simple div). What's missing that will make this work, and why is it not documented anywhere that I can see (it's not in the jquery append() documentation, in any case). Thanks in advance, Eric.
[jQuery] Re: When using append() , appended content is not treated by jquery
Thanks a lot Charlie, livequery() is precisely what I needed, it works great this way! Cheers, Eric. On Jun 14, 7:22 pm, Charlie charlie...@gmail.com wrote: problem is events won't trigger on new element introduced to DOM after document ready has fired unless you use live() or livequery(), these allow to bind to elements before they enter DOM read up on it, will be an easy fix
[jQuery] append() does not properly resize div when adding content
Hello, I'm creating a page that lists the available songs that I have for karaoke, and I'm having some difficulties with formatting. I'm using jquery to retrieve an XML created by php, and outputting it to the html page using jquery's append() function. However, when I do this, the DIV that contains the data (the one I'm appending) simply does not re-size with the data - so I have a div that's a few pixels high, and a data list that just floods out of it in the emptiness of my body background (white). The page is here: http://lucas.is-a-geek.com:8181/jquery/ The append code is: $.get('backend.php', function(parsexml){ $(parsexml).find('song').each(function(){ var id = $(this).find(ID).text(); var artist = $(this).find(artist).text(); var title = $(this).find(title).text(); html = div id=\songid + id + \ style=\float: left; width: 830px; height: 20px; border-top:1px solid #000;\; html = html + div class=\artist\ style=\float: left; width: 250px\ + artist + /div; html = html + div class=\title\ style=\float: left; width: 300px\ + title + /div; html = html + /div; $(#resultscontainer).append(html); //$(#resultscontainer).append(p id=songid + id + class= \trigger ui-state-default\a href=\#\ + author + - + title + /a/p); }); }); The DIV is simply: div id=resultscontainer class=ui-state-highlight ui-corner-all style=height: 100px; width:835px; /div Does anyone know how to fix this? I've tried setting a % or px height to the div, with no change in behavior. Oh, it happens both in Firefox and Internet Explorer equally.
[jQuery] Re: append() does not properly resize div when adding content
Awesome, that works! I hadn't set a static height at first, hadn't put any style in fact, so I was in a bind, but this works great for me. Thanks a lot! Eric. On Jun 12, 1:24 pm, amuhlou amysch...@gmail.com wrote: you're declaring a fixed height inline. the div is being told to only be 100px tall, so it doesn't matter how much content is inside it. try replacing height: 100px with float: left; On Jun 12, 11:38 am, Eric-Sebastien Lachance eslacha...@gmail.com wrote: Hello, I'm creating a page that lists the available songs that I have for karaoke, and I'm having some difficulties with formatting. I'm using jquery to retrieve an XML created by php, and outputting it to the html page using jquery's append() function. However, when I do this, the DIV that contains the data (the one I'm appending) simply does not re-size with the data - so I have a div that's a few pixels high, and a data list that just floods out of it in the emptiness of my body background (white). The page is here:http://lucas.is-a-geek.com:8181/jquery/ The append code is: $.get('backend.php', function(parsexml){ $(parsexml).find('song').each(function(){ var id = $(this).find(ID).text(); var artist = $(this).find(artist).text(); var title = $(this).find(title).text(); html = div id=\songid + id + \ style=\float: left; width: 830px; height: 20px; border-top:1px solid #000;\; html = html + div class=\artist\ style=\float: left; width: 250px\ + artist + /div; html = html + div class=\title\ style=\float: left; width: 300px\ + title + /div; html = html + /div; $(#resultscontainer).append(html); //$(#resultscontainer).append(p id=songid + id + class= \trigger ui-state-default\a href=\#\ + author + - + title + /a/p); }); }); The DIV is simply: div id=resultscontainer class=ui-state-highlight ui-corner-all style=height: 100px; width:835px; /div Does anyone know how to fix this? I've tried setting a % or px height to the div, with no change in behavior. Oh, it happens both in Firefox and Internet Explorer equally.
[jQuery] Re: Subversion and Bugtracking
Do you need to host it yourself and does it need to be private? If not, how about Project Hosting on Google Code[1]? [1] http://code.google.com/projecthosting/ -Eric On Jun 9, 4:20 am, Paulodemoc paulode...@gmail.com wrote: Someone here would happen to know a good bugtracking system that I can start using? It can be free or open source. I also use TortoiseSVN, does it work good with any system in particular? If someone here could point me the directions so I could start, I would be highly appreciated. Thanks, Paul
[jQuery] What is this type of UI widget called?
http://secretmountain.org/images/headline_widget.jpg You've seen them all over the place: Yahoo! Movies, CNet, Gamespot, etc. Usually they scroll through the items automatically like a slideshow, while a mouseover of one of the right-hand controls will pause the slideshow and reveal the selected item. A mouseout may resume the slideshow. I am looking for a JQuery plugin of this, but it's hard as I don't even know what to call it. I've looked at some of the carousel and slideshow plugins, and they are all very close but I haven't found any that let you define your own controls. They all generate the controls automatically as numbered links, which wouldn't work in this case. Any thoughts? Thanks!
[jQuery] Re: use jQuery object of parent in an iframe
Hi Beni, I've thrown together a pretty nifty plugin for handling this exact thing. (Neat problem to work on. :D ) Anyway, the plugin can be found here: http://snipplr.com/view/15393/inheritjs--jquery-sharing-between-parents-and-iframes/ There's a live proof-of-concept demo available here: http://eric.garside.name/inherit/ Some things to note: * The iFrames who wish to inherit jQuery from the parent need to call: parent.inherit( window ); * This function returns the iFrames jQuery object, as well as sets it up. This means you can also use this inheritance declaration to bind a document.ready function: parent.inhert( window )(function(){ alert( 'The iFrame DOM is ready!' ); * All the iFrame source code you're including on your page MUST (can't stress this enough) come from the same domain. Browsers are designed to prevent manipulation of the DOM of a page on a different domain through an iFrame. If the page which includes the iframes is on the same domain as the iframe source content themselves, things should work out nicely. * Once you call the parent.inherit( window ); function from the iFrame, and the iFrame dom is ready, you can proceed to use jQuery as if it were natively included. Let me know if you have trouble getting it to work, or have questions/ feature requests (such as the ability to track iFrame dom references by an arbitrary identifier, something I was going to implement, but then decided I didn't care enough to at the time. :P ) On May 28, 3:04 pm, beni behnam.tara...@gmail.com wrote: Hi, I am developing a web application with full of independent widgets in form of iframes. I would like to avoid embeding jquery (and jQuery UI) in each iframe's head to reduce number of requests and want to use the libs from the parent window instead. In iframes' head I tried the following code: window.$ = window.content.$; window.jQuery = window.content.jQuery; Well it works but naturally as the jquery object belongs to the parent document I can manipulate only the DOM nodes of parent document from the iframe and not the DOM nodes of the iframe itself! I think if I could replace the document object of window.$ with iframe's document object it would work! 1) any idea how, any other sollutions? 2) Is = copy by value or by reference? If I succeed to replace the document object in window.$, will it be also replaced in window.content.$? Thank you!
[jQuery] Re: calling functions between multiple document ready events
It's a simple scoping problem. Anything you create inside an anonymous function will be accessible only within the function. If you need something to be accessible between the anon. functions, simply move it into a higher scope, like the global namespace (eh, not idea) or the jQuery namespace (better idea). $(function(){ $.displayMessage(){ alert('hello world') } }); $(function(){ $.displayMessage(); }); On May 29, 12:18 pm, Brian FitzGerald fitzgeraldme...@gmail.com wrote: I know that you can have more than on document ready event without difficulty. i.e. $(function(){ // document ready 1 }); $(function(){ // document ready 2 }); The question I have is, is there any way for them to call functions from one to the other? The following does not work: $(function(){ function displayMessage(){ alert('hello world'); }; }); $(function(){ displayMessage(); }); This invokes a js error complaining that displayMessage() is not defined. Thanks in advance for any thoughts, Brian
[jQuery] [New Plugin] jQuery Generic Pagination
I figured I'd drop a message out to the board about a new plugin I've finished documenting and released, called Pagination. It's a small, relatively simple jQuery plugin which makes rendering and managing Pagination controls very easy. It automatically generates groupable controls, which can be themed, moved, and reused without a lot of overhead. The plugin is open ended, allowing the user to define how they want to render the content. It's a very simple way to create grouped pagination triggers. If ya'll could take a look at the docs and demo, and let me know if you have any suggestions, or come upon any problems, that'd be great. Thanks. :D Documentation: http://eric.garside.name/docs.html?p=pagination Demo: http://eric.garside.name/demo.html?p=pagination
[jQuery] Re: ajax append problem
When i try this i get an error object required in IE6 and 7. any thoughts? On Apr 27, 10:10 pm, Ricardo ricardob...@gmail.com wrote: I think you have to separate the selector otherwise it's just a hash: $(.content).load(test.html #content); http://docs.jquery.com/Ajax/load On Apr 27, 5:14 pm, Charlie charlie...@gmail.com wrote: $(.content).load(test.html#content); this will grab only theidcontent from test.html andloadit , can refine this down to elements within #content as well example on jQuery site shows same methodclicforw...@googlemail.comwrote:Hello Michael, thanks for this. I got a error: html.find is not a function Any idea? script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'/script script type=text/javascript $(document).ready(function(){ $.ajax({ url: leistung.html, cache: false, success: function(html) { var loadCont = html.find('#cont'); $(.content).append(loadCont); } }); }); /script On Apr 27, 5:07 pm, Michael Lawsonmjlaw...@us.ibm.comwrote:instead of $(.content).append(html); do var contentToAppend = html.find(#cont); $(.content).append(contentToAppend); cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-828-355-5544 E-mail: mjlaw...@us.ibm.com'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: clicforw...@googlemail.comclicforw...@googlemail.com To: jQuery (English)jquery-en@googlegroups.com Date: 04/27/2009 11:03 AM Subject: [jQuery]ajaxappend problem Hello, im using this script toloada external site into my DOM. It works fine but i need just a part of this test.html. For example: I want to append just the div #cont from test.html How can i do that? script type=text/javascript $.ajax({ url: test.html, cache: false, success: function(html){ $(.content).append(html); }}); /script Thanks for Help! graycol.gif 1KViewDownload ecblank.gif 1KViewDownload
[jQuery] Hover elements in wrong state once page finishes loading
Sorry if this has been addressed before -- it's a hard issue to describe. The page in question: http://testing.ericprice.cc The code in question: $(document).ready(function() { $(.teaser).hover(function() { $(this).addClass(hovered).find(.thumbnail).stop(true, true).slideDown(100); }, function() { $(this).removeClass(hovered).find(.thumbnail).stop(true, true).slideUp(200); }); }); The problem: http://testing.ericprice.cc/problem.png What I'm seeing is that if you move your mouse around the thumbnails before all of the page elements finish loading (which you might have to do rather quickly if you have a fast connection), once the page finishes loading, some of them will suddenly appear in their slid- down state despite not being hovered over. This happens in both Safari and Firefox, and only seems to happen when I'm using the slideDown/slideUp effects -- hide/show doesn't cause the same issue. Any thoughts? I've already tried .mouseover/.mouseout and .bind instead of .hover, but to no avail.
[jQuery] Re: Custom JSON sanitizing during $.ajax
Yea, that should fix the problem, return is a reserved word in javascript On May 7, 4:22 pm, Matt Critchlow matt.critch...@gmail.com wrote: try changing your parameter in the success method to something other than return and see what happens.. On May 7, 10:40 am, Eli Perelman e...@cobaltds.net wrote: Hello All, I am trying to complete an Ajax request in which PHP returns a JSON- formed string. One of the variables inside the JSON object contains a path, which contains backslashes. This seems to cause a problem because nothing in the success function seems to run. So, I tried cleaning the data using dataFilter, but cannot seem to get that to work either. Anybody have any insight on how to accomplish this? CODE: $.ajax({ async: false, type: POST, url: ajaxHandler, dataType: json, data: action=getInformationid= + id, dataFilter: function(data,type) { data.replace(/\\/g,); return data; }, success: function(return){ objInformation = return.detail[0]; } });
[jQuery] Re: Catch Errors from External Libraries
Try using a try-catch block around the scriptaculous code? There's really no other way that I'm aware of to capture a javascript error and continue processing. Though, depending on how crucial the module is, you may consider using something else. 3 frameworks, 2 major ones, on a site at the same time isn't ideal. On May 7, 4:08 pm, David Meiser dmei...@gmail.com wrote: This is slightly off topic, but if anybody can solve this, it'll be this mailing list. The basic question is: Is there a way to catch an error thrown in an external js library so that I can continue parsing the remaining javascript on the page? The more detailed version is this: I'm using DotNetNuke (DNN) for my website. A module that I'm using include Scriptaculous, DotNetNuke uses a mixture of jQuery and MS AJAX. To avoid namespace pollution, the DNN folk have used the jQuery prefix for jQuery functions and the $ shortcut for MS AJAX (actually, I think this is the only way you can do this). The third party module uses $ to reference Scriptaculous. I think we all know where this is going: the namespace pollution of $ causes an error to be thrown very early on, leaving parts of my page unstyled (cornerz), dates unformatted, etc, etc, etc. The good news - for me - is this only happens when an admin is logged in. My thought would be to catch the errors and continue parsing *my *portion of the page. Thanks in advance, Dave
[jQuery] Re: Is it possiblwe to use this in slection
Yes, you can. this refers to the HTMLElement in the context of an event handler. Though, your syntax is a bit wonky, should be: $('#slickbox' + this.id).toggle(400); On May 6, 4:13 am, Christos tsam...@gmail.com wrote: Hi all, I wanted to ask whether we can use this for selecting in jquery. What i want to do is to have one toggle function for many objects. the fuction i use now is the above $('a#slick-toggle').click(function() { $('#slickbox').toggle(400); return false; }); which toggles the slickbox when the slick-toggle is clicked. The problem that i have is that i want to have many objects like slick- toggle1 slickbox1, slick-toggle2 slickbox2. One way is to make different function for each a, but because the html is created dynamically, i don't know from the beggining how many i will have. So what i ask how i can do something like that $('a').click(function() { $('#slickbox+this.id').toggle(400); return false; }); where this.id is going to be the id of the a i click and #slickbox +this.id is the id of the object i want to hide. Christos
[jQuery] Re: recursive dom walker
Your recurse function is not a method of the jQuery.fn object, so it can't work on elements. The line: $.recurse = function(options) { should be $.fn.recurse = function(options) { On May 6, 9:00 am, AndyCramb andycr...@googlemail.com wrote: I am trying to write a plugin that will eventually match a specific string pattern on the id attribute of all form element(s) I aim to get a collection of all elements that I want to return for chaining I generate a regular expression on the fly based on the arguments passed in and use this to find an initial set of elements I have this returning jquery objects using this $(:input).filter(function() { //return this.id.match(regEx); return $(this).attr(id).match(regEx); }) this also works $(:input).filter(function() { return $(this).attr(id).match(regEx); }).setDisabled(true); But when I use this $(#a_1).recurse({source:a_1}).setDisabled (true); ,my plugin function I get this TypeError: $(#a_1).recurse is not a function Its my first attempt at a plugin and I guess I am not returning the jquery object and I am not sure if this is the correct approach Anyway any advice would be much appreciated Full code below (function($) { $.recurse = function(options) { var defaults = { delimeter: _ , level: 1 , dir: down , source: body } var settings = $.extend({}, defaults, options); // funtion to find regEx function generateRegEx(delimeter, src, direction) { console.log(src.split(delimeter)); console.log(src.length); // need to have the concept of next and prev // so for prev or back take away a wholePattern match // and fro next or forward add a pattern match // so based on src and the up or down param var dir = direction arr = src.split(delimeter); var arrLength = arr.length; console.log(arrLength); if (arrLength = 1 direction == up) { //alert(the only way is forward); throw Error(you can only go up from here); direction = up; } arrLength = (direction == up) ? arrLength - 2 : arrLength; //^([0-9a-zA-Z-]+\_){3}$ - this gets all the pattern does ntot take account of src // supercedes the one above ^a_1(\_[0-9a-zA-Z-]+){2}$ var delPattern = src + (\\ + delimeter + [0-9a-zA-Z-] +); //this will match the character that separates the levels var numerOfPattern = { + arrLength + }; //this matches all alpha-numeric characters in between the delimeters var wholePattern = delPattern + numerOfPattern; // this combines them both console.log(wholePattern); var pattern = ^ pattern += wholePattern; pattern += $; console.log(pattern); return new RegExp(pattern); }; var regEx = generateRegEx(settings.delimeter, settings.source, settings.dir); $(:input).filter(function() { //return this.id.match(regEx); return $(this).attr(id).match(regEx); }) }; })(jQuery);
[jQuery] Re: refresh image?
For reference, this php should properly force no-cache: Just be sure to replace $mime with the correct type for the image (jpg, gif, whatever you're sending) header('Content-Type: ' . $mime); header('Cache-Control: no-cache'); header('Pragma: no-cache'); On May 6, 2:30 pm, Ricardo ricardob...@gmail.com wrote: On May 6, 6:46 am, heohni heidi.anselstet...@consultingteam.de wrote: Hi, after sending a form, I would like to reload the form in order to send a new message. Therefore I was resetting the old form, but I need to call a new captch image. It's currently like this: img src=inc/captcha/captcha.php id=captcha alt= border=0 style=float:left; / I thought I coud re-load it with: $(#captcha).attr(src).replaceWith(inc/captcha/captcha.php); But this way I don't get a new call... to generate a new image and with it connected a new session entry for the captcha code. What can I do to create a real call to the file? Any ideas? .replaceWith() replaces one element with another. Use this: $(#captcha).attr(src, inc/captcha/captcha.php); This will reload the image assuming captcha.php is correctly sending a no-cache header.
[jQuery] Re: SimpleModal issues... too many scripts?
I just took a look and it looks like the main issue is that you are not binding the link correctly. You need to modify the selector in confirm.js from: $('#confirmDialog input.confirm, #confirmDialog a.confirm').click (function (e) { ... }); to: $('#navPhysicians a.confirm').click(function (e) { ... }); HTH On May 6, 10:53 am, Steeleclipse steelecli...@gmail.com wrote: Hi Everyone, I am new to the jquery world, but have found it quite useful... maybe a little too useful. It seems like I have too many scripts running. Is there a way to simplify what I have been doing in the markup to run them? Please take a look and let me know if I can narrow things down: http://woodlandswoundcare.com/test/index.html On to the bigger issue: I am attempting to use the Simplemodal jQuery script(http://www.ericmmartin.com/projects/simplemodal/) on this site as well. I have done (what I believe to be) everything in the example to get it running, but to no avail. I have revised the css and images to match the site, and I am trying to implement the script in a way so when you click on the physicians only tab on the top navigation bar, the modal box comes up warning visitors of the graphic content. The download of the script includes a working example, from which I just cut and pasted the code to make it work, or what I thought would make it work. Would someone to be willing to take a look and see what they could find? Also, if I have been unclear in my description of the issue, please let me know, and I will post anything else you might need to diagnose. Thanks in advance!
[jQuery] Re: recursive dom walker
You can return the jQuery object, but jQuery will throw undefined if you attempt to call $('.selector').recurse You'd have to call $.recurse You can implement a pretty quick fix, if you don't plan on doing much else with the function. Try: $.recurse = $.fn.recurse = function(options){ ... } On May 6, 3:51 pm, AndyCramb andycr...@googlemail.com wrote: Thanks Eric So is the only way to chain from an extended function in jQuery is to use $.fn.recurse= function(){} I cannot uses $.recurse = function() { } and return the jQuery object from within this function? Thanks andy On May 6, 3:13 pm, Eric Garside gars...@gmail.com wrote: Your recurse function is not a method of the jQuery.fn object, so it can't work on elements. The line: $.recurse = function(options) { should be $.fn.recurse = function(options) { On May 6, 9:00 am, AndyCramb andycr...@googlemail.com wrote: I am trying to write a plugin that will eventually match a specific string pattern on the id attribute of all form element(s) I aim to get a collection of all elements that I want to return for chaining I generate a regular expression on the fly based on the arguments passed in and use this to find an initial set of elements I have this returning jquery objects using this $(:input).filter(function() { //return this.id.match(regEx); return $(this).attr(id).match(regEx); }) this also works $(:input).filter(function() { return $(this).attr(id).match(regEx); }).setDisabled(true); But when I use this $(#a_1).recurse({source:a_1}).setDisabled (true); ,my plugin function I get this TypeError: $(#a_1).recurse is not a function Its my first attempt at a plugin and I guess I am not returning the jquery object and I am not sure if this is the correct approach Anyway any advice would be much appreciated Full code below (function($) { $.recurse = function(options) { var defaults = { delimeter: _ , level: 1 , dir: down , source: body } var settings = $.extend({}, defaults, options); // funtion to find regEx function generateRegEx(delimeter, src, direction) { console.log(src.split(delimeter)); console.log(src.length); // need to have the concept of next and prev // so for prev or back take away a wholePattern match // and fro next or forward add a pattern match // so based on src and the up or down param var dir = direction arr = src.split(delimeter); var arrLength = arr.length; console.log(arrLength); if (arrLength = 1 direction == up) { //alert(the only way is forward); throw Error(you can only go up from here); direction = up; } arrLength = (direction == up) ? arrLength - 2 : arrLength; //^([0-9a-zA-Z-]+\_){3}$ - this gets all the pattern does ntot take account of src // supercedes the one above ^a_1(\_[0-9a-zA-Z-]+){2}$ var delPattern = src + (\\ + delimeter + [0-9a-zA-Z-] +); //this will match the character that separates the levels var numerOfPattern = { + arrLength + }; //this matches all alpha-numeric characters in between the delimeters var wholePattern = delPattern + numerOfPattern; // this combines them both console.log(wholePattern); var pattern = ^ pattern += wholePattern; pattern += $; console.log(pattern); return new RegExp(pattern); }; var regEx = generateRegEx(settings.delimeter, settings.source, settings.dir); $(:input).filter(function() { //return this.id.match(regEx); return $(this).attr(id).match(regEx); }) }; })(jQuery);
[jQuery] Re: SimpleModal issues... too many scripts?
No problem and thanks...glad you got it working. ;) On May 6, 7:19 pm, Steeleclipse steelecli...@gmail.com wrote: Close. li#navPhysicians fixed it. I only quickly read your response earlier as I was at work, but at second glance, I realized this is your script. Thanks for a great script, and the assistance to get it working! On May 6, 3:49 pm, Steeleclipse steelecli...@gmail.com wrote: Thanks for your reply. I will try that tonight and post how it goes! On May 6, 3:37 pm, Eric Martin emarti...@gmail.com wrote: I just took a look and it looks like the main issue is that you are not binding the link correctly. You need to modify the selector in confirm.js from: $('#confirmDialog input.confirm, #confirmDialog a.confirm').click (function (e) { ... }); to: $('#navPhysicians a.confirm').click(function (e) { ... }); HTH On May 6, 10:53 am, Steeleclipse steelecli...@gmail.com wrote: Hi Everyone, I am new to the jquery world, but have found it quite useful... maybe a little too useful. It seems like I have too many scripts running. Is there a way to simplify what I have been doing in the markup to run them? Please take a look and let me know if I can narrow things down: http://woodlandswoundcare.com/test/index.html On to the bigger issue: I am attempting to use the Simplemodal jQuery script(http://www.ericmmartin.com/projects/simplemodal/) on this site as well. I have done (what I believe to be) everything in the example to get it running, but to no avail. I have revised the css and images to match the site, and I am trying to implement the script in a way so when you click on the physicians only tab on the top navigation bar, the modal box comes up warning visitors of the graphic content. The download of the script includes a working example, from which I just cut and pasted the code to make it work, or what I thought would make it work. Would someone to be willing to take a look and see what they could find? Also, if I have been unclear in my description of the issue, please let me know, and I will post anything else you might need to diagnose. Thanks in advance!
[jQuery] Re: The jQuery Object, Namespaces, and Program Modules -- Connecting the Dots Between jQuery and Javascript
I'll give it a shot explaining, feel free to correct me if I'm off. :) Basically, the jQuery core is broken up into three major pieces: * The Sizzle Selector Library * The jQuery Cache * The jQuery Namespace The selector library, and code associated with implementing it, provides jQuery with a way to traverse the DOM Tree of a page. This is the most basic functionality of jQuery: Finding the DOM elements you want to work with. Now, once jQuery finds the DOMElement you want to do something to, it adds it to the jQuery Cache using an expando property. Lets say I use the following selector: $('#myElement'); Sizzle parses out the selector, and makes a call similar to document.getElementById('myElement'); Now, jQuery assigns an identifier to this element and sets it as a property of the DOMElement. If you use firefox and Firebug, you can inspect the element, and browse it's DOM properties, and you will come across a custom property named something like jquery18203812379123. The numbers are merely a timestamp, and will change with every refresh of the page. The value of this expando will be something a simple integer, like 0 or 1 or 8. This value depends on when the element was accessed by jQuery. If you look at jQuery.Cache, you will see that it's an array, the id of which corresponds to the expando property value. So if myElement is the first element you accessed, it's expando ID would be 0, and it's accessible in the jQuery cache by calling jQuery.Cache [ 0 ]; The way jQuery works to add event handlers and custom data properties, is by adding them to the jQuery Cache object, instead of the actual element. The final piece of jQuery is its namespace. All the functions which work on jQuery objects are methods of jQuery.fn. If you add a method to this object, it will be accessible as part of the jQuery chain: ex. jQuery.fn.myMethod = function(){ alert( this.attr('id') ); } $('#myElement').myMethod(); // Alerts myElement That's basically it, inasmuch as I'm concerned. :) Hope it was at least a little helpful. On May 5, 12:20 pm, Josh Powell seas...@gmail.com wrote: Try this: http://www.learningjquery.com/category/levels/beginner?order=ascending On May 5, 9:08 am, kiusau kiu...@mac.com wrote: On May 5, 8:24 am, Rey Bango r...@reybango.com wrote: Great advice Matt. But, no source! Roddy