[jQuery] Re: My code is not working getting an error missing )
Ok so this is what i want to do and can't achieve. I have images that i'd like to rollover here is the markup for both of those instances, 1 is a button and the other is just a hyperlink div class=LPButtona href=index.php?act=viewProdamp;productId= {VAL_PRODUCT_ID} target=_selfimg src=skins/{VAL_SKIN}/ styleImages/buttons/LPmore.png alt=More border=0 //a/div form action={FORM_METHOD} method=post input name=email type=text size=14 maxlength=255 class=textboxMail value={LANG_EMAIL_ADDRESS} onclick=this.value=''; / input type=hidden name=act value=mailList / br / input type=image src=skins/{VAL_SKIN}/styleImages/buttons/joinnow- off.gif alt=Join Now / /form it was all working fine until i applied the png fix. which is jquery.pngFix which i downloaded from here http://jquery.andreaseberhard.de/pngFix/ Now i don't know how to fix this i have tried and tried and can't understand what i would need to do to make this all work. I need to use jquery because i want to keep my alt and title tags behind my images. Here is the code i have. which is not working in IE jQuery(function($) { function getLeaf(url) { var splited=url.split('?');// remove all the parameter from url url=splited[0]; return url.substring(url.lastIndexOf(/)+1);// return file name } jQuery.fn.extend({ enter: function() {//plugins creation return this.each(function() { var pth = $(this).find(img)[0]; //alert($(this).children().attr(href)); if($(this).children().attr(href)==getLeaf (document.location.href)){// check that the link url and document url $(pth).attr(src,pth.src.replace(/.png/g, '_active.png')); } else{ $(this).hover(function(){ $(pth).attr(src,pth.src.replace(/.png/ g,'_active.png'));// mouse over Image },function(){ $(pth).attr(src,pth.src.replace(/_active.png/ g,'.png')); }); } }); } }); $(function(){ // Document is ready $(.LPButton,.CatMoreBtn).enter();// call the function }); $('input[type=image]').hover( function () { $(this).attr(src, $(this).attr(src).split('- off').join('-on')); }, function () { $(this).attr(src, $(this).attr(src).split('- on').join('-off')); } ); }); jQuery(document).ready(function($){ $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix( ); }); Jess On Oct 11, 2:18 pm, jessie mi...@optusnet.com.au wrote: Hi Rick Thank-you very much yes it did get rid of the error. I'm also checking it in firebug and i can't see the other error your getting ie. $(div.LPButton, div.CatMoreBtn, div.CatBuyBtn).pngFix() is not a function Nevertheless the error is gone but now my hovering images don't work! Any reason why this is happening? Thank-you! Jess On Oct 11, 1:15 pm, Rick Faircloth r...@whitestonemedia.com wrote: Well, let's check the bracketing... (I need to format this so I can read it more easily...) jQuery(function($) { function getLeaf(url) { var splited=url.split('?'); url=splited[0]; return url.substring(url.lastIndexOf(/)+1); } jQuery.fn.extend({ enter: function() { return this.each(function() { var pth = $(this).find(img)[0]; if ( $(this).children().attr(href) == getLeaf(document.location.href) ) { $(pth).attr(src,pth.src.replace(/.png/g, '_active.png')); } else { $(this).hover(function() { $(pth).attr(src,pth.src.replace(/.png/g,'_active.png')); },function() { $(pth).attr(src,pth.src.replace(/_active.png/g,'.png')); }); } }); } }); }); jQuery(document).ready(function($){ $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix(); }); jQuery(document).ready(function($) { $(.button).hover(function() { $(.button).addClass(imgbuttonhover); $(.button).removeClass(imgbutton); }, function() { $(.button).addClass(imgbutton); $(.button).removeClass(imgbuttonhover); } ) }); After working with this in my editor, this is the bracketing that I used to eliminate the error you were getting. Now, however, I get this error in Firebug: $(div.LPButton, div.CatMoreBtn, div.CatBuyBtn).pngFix() is not a function If you copy the code above and put it in your editor, does the bracketing error go away? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of jessie Sent: Saturday, October 10, 2009 10:12 PM To: jQuery (English) Subject: [jQuery] Re: My code is not working getting an error missing ) yes the only error now i'm getting
[jQuery] Problem with accordion and rules and messages
hi, i use this example http://jquery.bassistance.de/validate/demo/multipart/ i change it in hItp://assuranceauto.tv/form/demo/test.php But i have a problem, how can i get rules and messages just for accordion 0 the first form,then accordion 1 the second form var v = $(#cmaForm).validate({ rules: { sexe : required, datenai: { required: true, dateNAI: true }, dateper: { required: true, datePER: true }, condacc : required, actpro : required } , messages: { sexe: sexe, datenai: { required: test reQUIRED, dateNAI: test date majeur }, dateper: { required: test reQUIRED, datePER: test date majeur }, condacc : cochez, actpro : cochez }, errorClass: warning, onkeyup: false, onblur: false, submitHandler: function() { alert(Submitted, thanks!); } }); // back buttons do not need to run validation $(#sf2 .prevbutton).click(function(){ accordion.accordion(activate, 0); current = 0; }); $(#sf3 .prevbutton).click(function(){ accordion.accordion(activate, 1); current = 1; }); $(#sf3 .prevbutton1).click(function(){ accordion.accordion(activate, 0); current = 0; }); $(#sf4 .prevbutton).click(function(){ accordion.accordion(activate, 1); current = 1; }); $(#sf4 .prevbutton1).click(function(){ accordion.accordion(activate, 0); current = 0; }); $(#sf4 .prevbutton2).click(function(){ accordion.accordion(activate, 2); current = 2; }); // these buttons all run the validation, overridden by specific targets above $(.open3).click(function() { if (v.form()) { accordion.accordion(activate, 3); current = 3; } }); $(.open2).click(function() { if (v.form()) { accordion.accordion(activate, 2); current = 2; } }); $(.open1).click(function() { if (v.form()) { accordion.accordion(activate, 1); current = 1; } }); $(.open0).click(function() { if (v.form()) { accordion.accordion(activate, 0); current = 0; } }); Thanks a lot
[jQuery] Ajax - Disable script eval
I am using the jQuery load function to grab HTML from other pages. I am only interested in the HTML and the scripts in the page are irrelevant. How can I skip the scripts eval? I tried to add a filter but the following doesn't seem to work: load(page.html *:not(script)) I was also considering overwriting the GlobalEval function (I don't want to alter the jQuery library itself), but I don't know how to do that... Thanks for your help!
[jQuery] Re: Assigning CSS 'display:block' by jquery not working
Hi, this appears to be happening because of specificity in the CSS. You have the 'hidden' on a direct specification i.e. the 'ul' in question. Try adding a class like : .hidden {display:none;} and then adding and removing that through your jQuery ul.addClass(hidden) ; ul.removeClass(hidden);That should work. CSS works through a cascade so that when you select something directly such as #id ul it takes precedence over simply adding a class to the element. Hope that makes sense? DED On Sat, Oct 10, 2009 at 3:02 PM, Caisys amamd...@gmail.com wrote: Hi, I am trying to display a hidden ul by using the $(id).addClass() method. For some reason the ul stays hidden. Can someone please help me?? Thanks ##mystyle.css ul#sitenav { padding:0; } ul#sitenav li{ display:inline; list-style-type:none; } ul#sitenav li ul{ display:none; } .selected { display:block; } -- ##sitenav.html ul id=sitenav liHomeul id=home-subnav liEvents/li liRestaurants/li liMovies/li liNighlife/li liStage/li /ul /li liVisitingul id=visiting-subnav liBasic Information/li liHotels/li liAttractions/li liEssential/li liTransportation/li liInquiries/li /ul /li liBlog/li liClassifieds/li /ul - ##script in index.html $(document).ready(function() { $(#home-subnav).addClass(selected); });
[jQuery] tablefilter with IE8
Hi all, I use TableFilter but it d'esn't work with IE8. I need to sort, search, and view a pager. I tried to correct by following the instructions: http://www.sitepoint.com/forums/showthread.php?t=61598, but this does not work. They advised me to go with tablesorter, but it does not search for real time what I need. Have you got a solution? Thanks for your help Best regards. Benoit
[jQuery] I load an external page in a div but it's java script functions didn't work
I load a page in a div and i use some effect from jquery in these pages but effect's didn't work script type=text/javascript jQuery(document).ready(function() { jQuery('#m12').click(function() { jQuery('#left_intd').load('eee.html'); return false; }); jQuery('#m22').click(function() { jQuery('#left_intd').load('logintemp.html'); return false; }); }); /script
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
Hi, javascript has an 'xor' operator. It works just like 'or' in an 'if' statement except in 'xor' only one side can be true. In a normal 'or' statement either side can be true or both can. So you probably want to do something like: if ( A XOR B) { } . Then only one can be true to continue if both are true the statement returns 'false'.Hope this helps. DED On Sat, Oct 10, 2009 at 10:37 PM, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] Re: My code is not working getting an error missing )
bump* anyone? ;) On Oct 11, 4:43 pm, jessie mi...@optusnet.com.au wrote: Ok so this is what i want to do and can't achieve. I have images that i'd like to rollover here is the markup for both of those instances, 1 is a button and the other is just a hyperlink div class=LPButtona href=index.php?act=viewProdamp;productId= {VAL_PRODUCT_ID} target=_selfimg src=skins/{VAL_SKIN}/ styleImages/buttons/LPmore.png alt=More border=0 //a/div form action={FORM_METHOD} method=post input name=email type=text size=14 maxlength=255 class=textboxMail value={LANG_EMAIL_ADDRESS} onclick=this.value=''; / input type=hidden name=act value=mailList / br / input type=image src=skins/{VAL_SKIN}/styleImages/buttons/joinnow- off.gif alt=Join Now / /form it was all working fine until i applied the png fix. which is jquery.pngFix which i downloaded from herehttp://jquery.andreaseberhard.de/pngFix/ Now i don't know how to fix this i have tried and tried and can't understand what i would need to do to make this all work. I need to use jquery because i want to keep my alt and title tags behind my images. Here is the code i have. which is not working in IE jQuery(function($) { function getLeaf(url) { var splited=url.split('?');// remove all the parameter from url url=splited[0]; return url.substring(url.lastIndexOf(/)+1);// return file name} jQuery.fn.extend({ enter: function() {//plugins creation return this.each(function() { var pth = $(this).find(img)[0]; //alert($(this).children().attr(href)); if($(this).children().attr(href)==getLeaf (document.location.href)){// check that the link url and document url $(pth).attr(src,pth.src.replace(/.png/g, '_active.png')); } else{ $(this).hover(function(){ $(pth).attr(src,pth.src.replace(/.png/ g,'_active.png'));// mouse over Image },function(){ $(pth).attr(src,pth.src.replace(/_active.png/ g,'.png')); }); } }); }}); $(function(){ // Document is ready $(.LPButton,.CatMoreBtn).enter();// call the function}); $('input[type=image]').hover( function () { $(this).attr(src, $(this).attr(src).split('- off').join('-on')); }, function () { $(this).attr(src, $(this).attr(src).split('- on').join('-off')); } );}); jQuery(document).ready(function($){ $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix( ); }); Jess On Oct 11, 2:18 pm, jessie mi...@optusnet.com.au wrote: Hi Rick Thank-you very much yes it did get rid of the error. I'm also checking it in firebug and i can't see the other error your getting ie. $(div.LPButton, div.CatMoreBtn, div.CatBuyBtn).pngFix() is not a function Nevertheless the error is gone but now my hovering images don't work! Any reason why this is happening? Thank-you! Jess On Oct 11, 1:15 pm, Rick Faircloth r...@whitestonemedia.com wrote: Well, let's check the bracketing... (I need to format this so I can read it more easily...) jQuery(function($) { function getLeaf(url) { var splited=url.split('?'); url=splited[0]; return url.substring(url.lastIndexOf(/)+1); } jQuery.fn.extend({ enter: function() { return this.each(function() { var pth = $(this).find(img)[0]; if ( $(this).children().attr(href) == getLeaf(document.location.href) ) { $(pth).attr(src,pth.src.replace(/.png/g, '_active.png')); } else { $(this).hover(function() { $(pth).attr(src,pth.src.replace(/.png/g,'_active.png')); },function() { $(pth).attr(src,pth.src.replace(/_active.png/g,'.png')); }); } }); } }); }); jQuery(document).ready(function($){ $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix(); }); jQuery(document).ready(function($) { $(.button).hover(function() { $(.button).addClass(imgbuttonhover); $(.button).removeClass(imgbutton); }, function() { $(.button).addClass(imgbutton); $(.button).removeClass(imgbuttonhover); } ) }); After working with this in my editor, this is the bracketing that I used to eliminate the error you were getting. Now, however, I get this error in Firebug: $(div.LPButton, div.CatMoreBtn, div.CatBuyBtn).pngFix() is not a function If you copy the code above and put it in your editor, does the bracketing error go away? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
How can I write the code in the context of Jquery validate function? On Oct 11, 12:43 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, javascript has an 'xor' operator. It works just like 'or' in an 'if' statement except in 'xor' only one side can be true. In a normal 'or' statement either side can be true or both can. So you probably want to do something like: if ( A XOR B) { } . Then only one can be true to continue if both are true the statement returns 'false'.Hope this helps. DED On Sat, Oct 10, 2009 at 10:37 PM, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] Re: My code is not working getting an error missing )
Hi, again, Jessie... Just wanted to let you know I haven't given up on you. It's was about midnight here and time for some sleep. Now I'm up again and I'll be able to take a look at your code later today and see if we can figure things out. I'm not the brightest knot on the jQuery log, but I'm persistent, as I can tell you are. I don't code in PHP, (I use ColdFusion) so I'll have trouble understanding that code, but maybe we can figure out a solution. I'll have to get the pngFix code, too. Can you email me directly and attach the images you're using so I can at least try to get the rollover part working? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of jessie Sent: Sunday, October 11, 2009 8:31 AM To: jQuery (English) Subject: [jQuery] Re: My code is not working getting an error missing ) bump* anyone? ;) On Oct 11, 4:43 pm, jessie mi...@optusnet.com.au wrote: Ok so this is what i want to do and can't achieve. I have images that i'd like to rollover here is the markup for both of those instances, 1 is a button and the other is just a hyperlink div class=LPButtona href=index.php?act=viewProdamp;productId= {VAL_PRODUCT_ID} target=_selfimg src=skins/{VAL_SKIN}/ styleImages/buttons/LPmore.png alt=More border=0 //a/div form action={FORM_METHOD} method=post input name=email type=text size=14 maxlength=255 class=textboxMail value={LANG_EMAIL_ADDRESS} onclick=this.value=''; / input type=hidden name=act value=mailList / br / input type=image src=skins/{VAL_SKIN}/styleImages/buttons/joinnow- off.gif alt=Join Now / /form it was all working fine until i applied the png fix. which is jquery.pngFix which i downloaded from herehttp://jquery.andreaseberhard.de/pngFix/ Now i don't know how to fix this i have tried and tried and can't understand what i would need to do to make this all work. I need to use jquery because i want to keep my alt and title tags behind my images. Here is the code i have. which is not working in IE jQuery(function($) { function getLeaf(url) { var splited=url.split('?');// remove all the parameter from url url=splited[0]; return url.substring(url.lastIndexOf(/)+1);// return file name} jQuery.fn.extend({ enter: function() {//plugins creation return this.each(function() { var pth = $(this).find(img)[0]; //alert($(this).children().attr(href)); if($(this).children().attr(href)==getLeaf (document.location.href)){// check that the link url and document url $(pth).attr(src,pth.src.replace(/.png/g, '_active.png')); } else{ $(this).hover(function(){ $(pth).attr(src,pth.src.replace(/.png/ g,'_active.png'));// mouse over Image },function(){ $(pth).attr(src,pth.src.replace(/_active.png/ g,'.png')); }); } }); }}); $(function(){ // Document is ready $(.LPButton,.CatMoreBtn).enter();// call the function}); $('input[type=image]').hover( function () { $(this).attr(src, $(this).attr(src).split('- off').join('-on')); }, function () { $(this).attr(src, $(this).attr(src).split('- on').join('-off')); } );}); jQuery(document).ready(function($){ $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix( ); }); Jess On Oct 11, 2:18 pm, jessie mi...@optusnet.com.au wrote: Hi Rick Thank-you very much yes it did get rid of the error. I'm also checking it in firebug and i can't see the other error your getting ie. $(div.LPButton, div.CatMoreBtn, div.CatBuyBtn).pngFix() is not a function Nevertheless the error is gone but now my hovering images don't work! Any reason why this is happening? Thank-you! Jess On Oct 11, 1:15 pm, Rick Faircloth r...@whitestonemedia.com wrote: Well, let's check the bracketing... (I need to format this so I can read it more easily...) jQuery(function($) { function getLeaf(url) { var splited=url.split('?'); url=splited[0]; return url.substring(url.lastIndexOf(/)+1); } jQuery.fn.extend({ enter: function() { return this.each(function() { var pth = $(this).find(img)[0]; if ( $(this).children().attr(href) == getLeaf(document.location.href) ) { $(pth).attr(src,pth.src.replace(/.png/g, '_active.png')); } else { $(this).hover(function() { $(pth).attr(src,pth.src.replace(/.png/g,'_active.png')); },function() { $(pth).attr(src,pth.src.replace(/_active.png/g,'.png')); }); } }); } }); });
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
Hi, if you are using the validation plugin, I believe it has a function addMethod that allows you to write your own method for the validation. It requires a name (javascript identifier), a method to check input against ( in your case A and B would be checked for completion) and a message to display when there is an error (i.e. neither A nor B is filled out, or both are). You can get the details for using the addMethod function at the jQuery Docs page. http://docs.jquery.com/Plugins/Validation The page lists demos and the function you need is toward the bottom of the page. The logic is fairly straight forward : when the form is being filled out listen for when A and B have focus, remember if either is checked or ignored and check to make sure both are not simultaneously filled out. Check this on submit as well. Good luck, DED On Sun, Oct 11, 2009 at 7:42 AM, Phper hi.steven...@gmail.com wrote: How can I write the code in the context of Jquery validate function? On Oct 11, 12:43 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, javascript has an 'xor' operator. It works just like 'or' in an 'if' statement except in 'xor' only one side can be true. In a normal 'or' statement either side can be true or both can. So you probably want to do something like: if ( A XOR B) { } . Then only one can be true to continue if both are true the statement returns 'false'.Hope this helps. DED On Sat, Oct 10, 2009 at 10:37 PM, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] Re: Using jquery ui plugin. Don't know what functions name to use.
the functions for the labs examples aren't likely in production version of jQueryUI, you'll need to include whatever js files they are using as well Aaron wrote: HI, I am using this: http://jquery-ui.googlecode.com/svn/branches/labs/carousel/demo/index.html plugin to jquery ui. The problem is that it's not working at all. I downloaded the firefox debugger and it's spitting out a error saying that it can't find the function of carousel. I am not sure what the function is called. Their is no documentation but their are demos that I can look at the source code. I see them using .carousel as a function so I used that same function call. Yet I can't get my carousel to work.
[jQuery] Publish subscribe / event pooling
I've been noodling around on how to create a pubsub system that doesn't depend on linking objects and events together. Based on previous post it turns out to be straight forward with bind and trigger (see code below). However, two things I can't figure out. I can't figure out why namespaced events don't work with this. The event's never fire...or at lest the 'bound' objects never receive them. The other thing is related to 'live'? Shouldn't this work with 'live' as well? !DOCTYPE HTML PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml;head meta http-equiv=content-type content=text/html; charset=UTF-8 titleConforming XHTML 1.0 Strict Template/title script src=pubsub3_files/jquery.js/script script type=text/javascript $(function() { //bind an object to an event. //When event is triggered, the function is called with e being the event object // and e.type the name of the event, and e.target the html element, // which should be the same as 'this' scope // ? Can't figure out how to use 'live' instead of 'bind' // ? Namespaced events ('event.namspace') don't seem to work $('#div1').bind('customAjaxStart', function(e, data){ console.log('event.target: '+e.target+ ', event.type: '+ e.type + ', data: '+ data); $(this).slideUp('slow'); }); $('#div2').bind('customAjaxStart', function(e, data){ console.log('event.type: '+ e.type + ', data: '+ data); $(this).slideUp('slow'); }); $('#test').click( function(){ //easily remove a listener with 'unbind' $('#div1').unbind('customAjaxStart'); //triggering events via the $.event scope. //pass in any data. $.event.trigger('customAjaxStart',{user:'something'}); //anything goes with an object $.event.trigger('customAjaxStart',['something2']); //simple data doesn't work unless wrapped in [ ]. }); }); /script /headdiv FirebugVersion=1.4.3 style=display: none; id=_firebugConsole/divbody input id=test value=trigger ajax start type=button div id=div1DIV 1/div div id=div2DIV 2/div /body/html
[jQuery] Error message
Hi, Three values must add up to 100%. I have used two selects; #Stock_materials and #Stock_WIP with then third #Stock_Finished automatically displaying the result. Issue is that I want to highlight #Stock_WIP in red with an error message if the total in Stock_WIP is =100. How do I add it into the below? $(document).ready(function() { $(#Stock_materials, #Stock_WIP).change(function() { $(#Stock_Finished).val(100 - Number($(#Stock_materials).val()) - Number($ (#Stock_WIP).val()) +%); }); });
[jQuery] Re: Hide checkbox when choosen value in select 0
On Sat, Oct 10, 2009 at 1:45 PM, Tan it_qn2...@yahoo.com wrote: Hello, span id=thmr_5 class=thmr_call div class=form-item id=edit-sitewide-wrapper label class=option for=edit-sitewideinput type=checkbox name=sitewide id=edit-sitewide value=1 class=form-checkbox / site wide/label /div /span span id=thmr_7 class=thmr_call div class=form-item id=edit-termwide-wrapper label for=edit-termwideChoosen get termwide: /label select name=termwide class=form-select id=edit-termwide option value=0 selected=selectedNo choosen/optionoption value=256Term1/optionoption value=257Term2/option/select /div /span I have code jquery when i choosen select options value 0 then disable checkbox : $('#edit-termwide').click(function() { if ($(#edit-termwide option:selected).length 0) { $('#edit-sidewide').attr('disabled', true); } else { $('#edit-sidewide').attr('disabled', false); } }); but it's not work please help me! First, you have a typo: id=edit-sitewide '#edit-sidewide' And you should use change(), not click(). Here are a couple of different ways to handle it: $(function() { $('#edit-termwide').change(function() { $('#edit-sitewide').attr( 'disabled', parseInt($(#edit-termwide option:selected).val()) 0 ? 'disabled' : '' ); }); }); $(function() { $('#edit-termwide').change(function() { if (parseInt($('#edit-termwide option:selected').val()) 0) { $('#edit-sitewide').attr('disabled', 'disabled'); } else { $('#edit-sitewide').removeAttr('disabled'); } }); });
[jQuery] Re: Assigning CSS 'display:block' by jquery not working
Rick, I am trying to have a two level horizontal nav bar. The second levels would be hidden by default. Depending on the location of the page being served the right one should be displayed by jq. Don, You are right assignment by id (#) takes higher priority over assignment by class. I couldn't locate this information before because I was unaware of the term specificity. Thanks All On Oct 11, 6:50 am, Don Dunbar salemd1s...@gmail.com wrote: Hi, this appears to be happening because of specificity in the CSS. You have the 'hidden' on a direct specification i.e. the 'ul' in question. Try adding a class like : .hidden {display:none;} and then adding and removing that through your jQuery ul.addClass(hidden) ; ul.removeClass(hidden);That should work. CSS works through a cascade so that when you select something directly such as #id ul it takes precedence over simply adding a class to the element. Hope that makes sense? DED On Sat, Oct 10, 2009 at 3:02 PM, Caisys amamd...@gmail.com wrote: Hi, I am trying to display a hidden ul by using the $(id).addClass() method. For some reason the ul stays hidden. Can someone please help me?? Thanks ##mystyle.css ul#sitenav { padding:0; } ul#sitenav li{ display:inline; list-style-type:none; } ul#sitenav li ul{ display:none; } .selected { display:block; } -- ##sitenav.html ul id=sitenav liHomeul id=home-subnav liEvents/li liRestaurants/li liMovies/li liNighlife/li liStage/li /ul /li liVisitingul id=visiting-subnav liBasic Information/li liHotels/li liAttractions/li liEssential/li liTransportation/li liInquiries/li /ul /li liBlog/li liClassifieds/li /ul - ##script in index.html $(document).ready(function() { $(#home-subnav).addClass(selected); });
[jQuery] Re: How to link the JQuery
Charlie Griefer wrote: There's no functional difference between using an external .js file or putting your JS in the page itself. Arguably, it's easier to maintain if it's well-organized in included files... but functionally no different. Well, there's the advantage of the .js file being cached in the browser in subsequent page requests... but other than that, functionally no different :) Well, unless you're using XHTML, that is. It's very hard to stay valid using JS in the page itself, if the page is XHTML. So, if you do use XHTML, then external JS is clearly the right thing, except for some simple setting of variables etc, that can be done reasonably safely in XHTML. -- Bertilo Wennergren http://bertilow.com
[jQuery] Obfuscated jQuery
I realize I could go through and obfuscate (condense) the file myself for the purpose of faster performance, but it's 4,377 lines of code. Is there an obfuscated version of 1.3.2 anywhere?
[jQuery] LavaLamp problem in IE
I have a site where the horizontal LavaLamp top menu is fine in FF, but in IE6 is so spaced out that it overflows and looks horrible. As a work around I have squeezed all of the links together so they fit in IE. However they are now all squeezed together and off-center in FF, so it now looks rubbish in FF. Any thoughts on how to fix this would be appreciated. site is: http://www.wilkinson-associates.co.uk/ Thanks. Peter
[jQuery] Newbie trying to Ajax in IE8
hello, im newb in jquery ajax. im trying to make this code work in IE8 and i dont know what im doing wrong. is a simple call with $.ajax to get a word from a php Works fine in Firefox and Chrome, but in IE8 seems like .find wont find the word tag. i been looking at the discussion mails but cant find an answer, i hope someone can help me. thanks. pd : sorry for my bad english. =D test.html -- htmlhead meta http-equiv=Content-Type content=text/html;charset=ISO-8859-1 script type=text/javascript src=jquery-1.3.2.min.js/script script type=text/javascript function test() { $.ajax({type:GET,url:test.php, success: function(xml) { alert(xml); // just to check im getting the xml text $(xml).find('word').each(function(){ alert(test 1 - the word is : +$(this).text()); }); alert(test 2 - the word is : +$(word, xml).text()); } }); } /script title/title /head body input type=button onClick=test() value=GO /body /html test.php - ?php header('Content-type: text/xml'); $xml = ?xml version='1.0' encoding='ISO-8859-1'\n; $xml .= answer; $xml .= wordhello/word; $xml .= /answer; echo $xml; ?
[jQuery] Re: LavaLamp problem in IE
Hi, this sounds like a CSS issue actually. You should search for how to make a conditional comment in X/HTML and apply a separate style sheet for IE using that. The reason this happens is probably because of how IE especially 6 and earlier handles the box-model in css differently. And so styles like margin and padding and width behave in a different way than in FF or Safari etc. DED On Sun, Oct 11, 2009 at 10:07 AM, Peter graticu...@yahoo.com wrote: I have a site where the horizontal LavaLamp top menu is fine in FF, but in IE6 is so spaced out that it overflows and looks horrible. As a work around I have squeezed all of the links together so they fit in IE. However they are now all squeezed together and off-center in FF, so it now looks rubbish in FF. Any thoughts on how to fix this would be appreciated. site is: http://www.wilkinson-associates.co.uk/ Thanks. Peter
[jQuery] Re: Obfuscated jQuery
On Oct 11, 2009, at 1:05 PM, elle wrote: I realize I could go through and obfuscate (condense) the file myself for the purpose of faster performance, but it's 4,377 lines of code. Is there an obfuscated version of 1.3.2 anywhere? We don't officially support an obfuscated (packed) version of jQuery anymore. You'll almost certainly get better performance by using the minified version and having it gzipped on the server side. The minified version is available from the jQuery homepage ( http://jquery.com/ ). --Karl Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Select element in form?
Hi, I have a form and want to select a text input element _in that specific form_. This is my code: $(form [name= +formName + ] :text[name= +textInputField+ ])) formName: a form in my document textInputField: a input type=text in my document If I do this alert($(form [name= +formName + ] :text[name= +textInputField+ ])).length) I get 0 If I do this alert($(:text[name= +textInputField+ ])).length) I get 1 I have no idea what I am doing wrong...
[jQuery] $.post and form data
Can someone explain a little bit more (more then jQuery's docs) about how the $.post operates? I know it's a shortcut for .ajax and it uses the HTTP POST request. So I'm guessing it's not sending the same request the form would send... i.e. you HAVE to provide the data to the php script through $.post. Is that correct? Then my next question is, if I have a set of check boxes and name each box services []... PHP will load the value of each into an array. Is there a quick way to assign these value to a JS variable to pass onto the PHP script? Because PHP doesn't create that array until the POST request, correct? But since I am using $.post, PHP is not making the request, therefore doesn't create the array. Is that right? So I must do it manually in JS... what would be best/quickest way to go about this? Thanks for the help.
[jQuery] [BUG?] Ie8 span.show() on a.hover()
Hi, i'm trying to make a div showing when user moves mouse over a link, so html is this: a href=page.php?id=3 class=menuItem id=newsnews/a span id=newsBar a href=mandiprovanews/abr a href=mandiprovanews/abr a href=mandiprovanews/abr /span a href=page.php?id=3 class=menuItem id=eventieventi/a span id=eventsBar a href=mandiprovaeventi/abr a href=mandiprovaeventi/abr a href=mandiprovaeventi/abr /span i've inserted this jquery code: $('#eventi').hover(function(e) { $('#eventsBar').show(fast); }); $('#eventsBar').bind(mouseleave,function(e) { $('#eventsBar').hide(fast); }); $('#news').hover(function(e) { $('#newsBar').show(fast); }); $('#newsBar').bind(mouseleave,function(e) { $('#newsBar').hide(fast); }); so, in IE7, hovering the first link makes the newsBar span showing and hovering the second makes eventsBar showing. In IE8, only the last link works (i've tried to add one more link and first 2 doesn't working).. The problem is with the .show function, if i use the .css (display,block) the span appears but i want to make it animate.. Here you can find a live demo http://www.pedalegemonese.it/testing/test.php
[jQuery] Re: LavaLamp problem in IE
Hi, I have exactly the same problem as Peter. I have tried to modify the lavalamp css as per Don's suggestion but have so far been unsuccessful. Can anybody provide some example code or documentation as to how to go about modifying the css on Peter's so that it works with IE? Any help appreciated! Thanks On Oct 12, 6:18 am, Don Dunbar salemd1s...@gmail.com wrote: Hi, this sounds like a CSS issue actually. You should search for how to make a conditional comment in X/HTML and apply a separate style sheet for IE using that. The reason this happens is probably because of how IE especially 6 and earlier handles the box-model in css differently. And so styles like margin and padding and width behave in a different way than in FF or Safari etc. DED On Sun, Oct 11, 2009 at 10:07 AM, Peter graticu...@yahoo.com wrote: I have a site where the horizontal LavaLamp top menu is fine in FF, but in IE6 is so spaced out that it overflows and looks horrible. As a work around I have squeezed all of the links together so they fit in IE. However they are now all squeezed together and off-center in FF, so it now looks rubbish in FF. Any thoughts on how to fix this would be appreciated. site is:http://www.wilkinson-associates.co.uk/ Thanks. Peter
[jQuery] Treeview - Custom hyperlink click event
I am trying to remove the default behaviour from the A within the Treeview structure. I want the +/- icons to continue to toggle but when a user clicks on the A I want to fire my own event. This event is currently firing fine, but it also fires the toggle behaviour meaning the tree still expands or collapses. Wrong! http://pastie.org/650742 Does anybody know how I can solve this? I tried unbind() and die() on all a's within the tree but that did nothing. Im really stuck on this one! .
[jQuery] Re: Select element in form?
You have a space between form and [name=...] . In CSS a space is a descendant selector, so it's expecting some descendant of the form to have a name equal to formName. Remove the space and you should be fine. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 11, 2009, at 5:12 PM, zephyr wrote: Hi, I have a form and want to select a text input element _in that specific form_. This is my code: $(form [name= +formName + ] :text[name= +textInputField+ ])) formName: a form in my document textInputField: a input type=text in my document If I do this alert($(form [name= +formName + ] :text[name= +textInputField+ ])).length) I get 0 If I do this alert($(:text[name= +textInputField+ ])).length) I get 1 I have no idea what I am doing wrong...
[jQuery] Re: $.post and form data
On Oct 11, 2009, at 3:35 PM, Jason wrote: Can someone explain a little bit more (more then jQuery's docs) about how the $.post operates? I know it's a shortcut for .ajax and it uses the HTTP POST request. So I'm guessing it's not sending the same request the form would send... i.e. you HAVE to provide the data to the php script through $.post. Is that correct? Then my next question is, if I have a set of check boxes and name each box services []... PHP will load the value of each into an array. Is there a quick way to assign these value to a JS variable to pass onto the PHP script? Because PHP doesn't create that array until the POST request, correct? But since I am using $.post, PHP is not making the request, therefore doesn't create the array. Is that right? So I must do it manually in JS... what would be best/quickest way to go about this? Thanks for the help. You can send the form's input values as a serialized string using .serialize(). So, if you have a form with id=foo you could do something like this: $('#foo').submit() { var formData = $(this).serialize(); $.post('/path/to/file/', formData, function() { // do something when post is successful. }); return false; }); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Simple Tooltip
Hello, I need a simple tooltip which html markup is only a div. I have the following: this.tooltip = function(){ /* CONFIG */ xOffset = 10; yOffset = 20; // these 2 variable determine popup's distance from the cursor // you might want to adjust to get the right result /* END CONFIG */ $(a.tooltip).hover(function(e){ this.t = this.title; this.title = ; $(body).append(div id='tooltip'span+ this.t +/span/ div); $(#tooltip) .css(top,(e.pageY - xOffset) + px) .css(left,(e.pageX + yOffset) + px) .fadeIn(fast); }, function(){ this.title = this.t; $(#tooltip).remove(); }); $(a.tooltip).mousemove(function(e){ $(#tooltip) .css(top,(e.pageY - xOffset) + px) .css(left,(e.pageX + yOffset) + px); }); }; How can I change this plugin to use CSS Class selectors? And how can I add a parameter to define the tooltip div CSS Class? Does anyone knows a better Simple Tooltip? Most tooltips I see have complex markup and some of them even include headers tags in the tooltip which in my opinion shouldn't happen. Thanks, Miguel
[jQuery] Re: Treeview - Custom hyperlink click event
are you returning false from your event handler? That *should* stop all other event processing. You could also try to capture the event object (i.e. .click(function(theEvent) { }); ) and then make use of the .stopPropagation() method. Neither trick will do you any good if the treeview's event handlers are fired before your event though. Some random thoughts.. Haven't tried any of this. Shawn philsturgeon wrote: I am trying to remove the default behaviour from the A within the Treeview structure. I want the +/- icons to continue to toggle but when a user clicks on the A I want to fire my own event. This event is currently firing fine, but it also fires the toggle behaviour meaning the tree still expands or collapses. Wrong! http://pastie.org/650742 Does anybody know how I can solve this? I tried unbind() and die() on all a's within the tree but that did nothing. Im really stuck on this one! .
[jQuery] Re: Ajax - Disable script eval
Update: I ended up adding this line of code to my script: jQuery.globalEval = function(){}; I am still interested in advice if there's a better way. On Oct 11, 10:12 am, Christophe christophe.humb...@gmail.com wrote: I am using the jQuery load function to grab HTML from other pages. I am only interested in the HTML and the scripts in the page are irrelevant. How can I skip the scripts eval? I tried to add a filter but the following doesn't seem to work: load(page.html *:not(script)) I was also considering overwriting the GlobalEval function (I don't want to alter the jQuery library itself), but I don't know how to do that... Thanks for your help!
[jQuery] Re: Select element in form?
On Oct 12, 7:12 am, zephyr marc.at.comp...@gmail.com wrote: Hi, I have a form and want to select a text input element _in that specific form_. This is my code: $(form [name= +formName + ] :text[name= +textInputField+ ])) Why not: $(document.forms[formName].elements[inputName]) -- Rob
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
A good clue. But I still don't know where to write the if statement. It would be good if you can give me an example. On Oct 11, 10:57 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, if you are using the validation plugin, I believe it has a function addMethod that allows you to write your own method for the validation. It requires a name (javascript identifier), a method to check input against ( in your case A and B would be checked for completion) and a message to display when there is an error (i.e. neither A nor B is filled out, or both are). You can get the details for using the addMethod function at the jQuery Docs page.http://docs.jquery.com/Plugins/Validation The page lists demos and the function you need is toward the bottom of the page. The logic is fairly straight forward : when the form is being filled out listen for when A and B have focus, remember if either is checked or ignored and check to make sure both are not simultaneously filled out. Check this on submit as well. Good luck, DED On Sun, Oct 11, 2009 at 7:42 AM, Phper hi.steven...@gmail.com wrote: How can I write the code in the context of Jquery validate function? On Oct 11, 12:43 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, javascript has an 'xor' operator. It works just like 'or' in an 'if' statement except in 'xor' only one side can be true. In a normal 'or' statement either side can be true or both can. So you probably want to do something like: if ( A XOR B) { } . Then only one can be true to continue if both are true the statement returns 'false'.Hope this helps. DED On Sat, Oct 10, 2009 at 10:37 PM, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] Display fails when jQuery.js isn’t cached . When cached, page displayed OK.
I have jQuery UI Tabs which load their content via AJAX. About once every 15 times when the entire page is loaded (not just XHR), things fail and I don't see the proper content in the tab. The jQuery executes without error, but the page display is wrong. Fiddler showed me that when things fail I also see that jQuery.js and jQuery-ui.js are both sent to the browser in full (~100kB). Normally, a page load results in HTTP status code 304 for both of those files, they're not re-downloaded, and the page displays properly. When the status code is 200 and fresh copies of jQuery/UI are sent, things fail. I notice this most often in IE8, but that's because I use it for web development. I have seen it in Firefox, but for some reason I can't reproduce it now. Fiddler shows that the HTTP request asks for: GET /Scripts/jquery-1.3.2.min.js?_=1255309685187 HTTP/1.1 I can't figure out what the ?_=1255309685187 is for, but I'm guessing it's a token to indicate for how long the file should be cached. Since I can't reproduce the problem in Firefox right now, I don't know what Firebug says. Any insight would be appreciated.
[jQuery] jQuery blockUI overlay color and cursor doesn't work on firefox 3.5.3 (linux)
jQuery blockUI shows a grey overlay on all browsers on window. But on linux firefox (3.5.3 3.0.10) the overlay is transparent no matter what color and opacity is set. The 'wait' cursor also doesn't work on linux firefox while it works as expected on all browsers on windows.
[jQuery] Re: New SlickGrid example page - AJAX loading
Hi Tin, Is there an API to add new column ? Thanks! On Oct 9, 4:32 am, Tin michael.leib...@gmail.com wrote: A lot of people have been asking for an example of how to use SlickGrid with remote data stores. I've just added a new sample page that does just that: http://slickgrid.googlecode.com/svn/trunk/examples/example6-ajax-load... The page will pull all Apple-related stories from Digg.com and display them in a grid. I've also added an option to set a user-defined row height (something I've meant to do for a long time). Check it out athttp://code.google.com/p/slickgrid/
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
script type=text/javascript src=http://code.jquery.com/jquery- latest.js/script script type=text/javascript src=http://dev.jquery.com/view/trunk/ plugins/validate/jquery.validate.js/script script type=text/javascript !-- $(document).ready(function() { $(#form1).validate({ rules: { title: { required: true, minlength:40 } , content: { required: true, minlength:100, maxlength:600 }, evaluation: { required: true, minlength:50, maxlength:300 }, price: { required: true, digits:true }, multi:{ required:true } }, messages: { } }); }); -- /script As you can see from the code above, title, content, evaluation, prices and multi are required. All of them are required. But there are additional two fields, which are participations and days. Only one of them is required. Either participations or days is required. How to write this code? On Oct 12, 10:17 am, Phper hi.steven...@gmail.com wrote: A good clue. But I still don't know where to write the if statement. It would be good if you can give me an example. On Oct 11, 10:57 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, if you are using the validation plugin, I believe it has a function addMethod that allows you to write your own method for the validation. It requires a name (javascript identifier), a method to check input against ( in your case A and B would be checked for completion) and a message to display when there is an error (i.e. neither A nor B is filled out, or both are). You can get the details for using the addMethod function at the jQuery Docs page.http://docs.jquery.com/Plugins/Validation The page lists demos and the function you need is toward the bottom of the page. The logic is fairly straight forward : when the form is being filled out listen for when A and B have focus, remember if either is checked or ignored and check to make sure both are not simultaneously filled out. Check this on submit as well. Good luck, DED On Sun, Oct 11, 2009 at 7:42 AM, Phper hi.steven...@gmail.com wrote: How can I write the code in the context of Jquery validate function? On Oct 11, 12:43 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, javascript has an 'xor' operator. It works just like 'or' in an 'if' statement except in 'xor' only one side can be true. In a normal 'or' statement either side can be true or both can. So you probably want to do something like: if ( A XOR B) { } . Then only one can be true to continue if both are true the statement returns 'false'.Hope this helps. DED On Sat, Oct 10, 2009 at 10:37 PM, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?