[jQuery] Re: Get parent url and add to a textarea
You Sir are a genius! Thank you so much :) On Sep 27, 5:00 am, ricardobeat [EMAIL PROTECTED] wrote: Ok. Your instance of jQuery is living in the parent window, so you need to reference it from inside the pop-up. Use this inside your pop-up code: script type=text/javascript $ = window.opener.$; $(window).load(function(){ $('#message',document).val(window.opener.location.href);}); /script Working on FF3 here - ricardo On Sep 26, 8:27 am,stinhambo[EMAIL PROTECTED] wrote: The HTML is - ul id=content_header_tools li id=tools_contact_usa href={path=contact-us/index}Contact Us/a/li li id=tools_email_pagea href={path=email-page/index} rel=email_pageEmail Page/a/li li id=tools_print_pagea href=javascript:window.print();Print Page/a/li /ul and this is part of what sits in my external file - $('a[rel=video_demo]').click(function(){ window.open(this.href,'mywindow','height=460,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); $('a[rel=share_story], a[rel=video_story]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); // This passes along the URL of the parent opener when clicking Email this page $(#message).get(0).value += window.opener.location.href; On Sep 26, 10:31 am, ricardobeat [EMAIL PROTECTED] wrote: Now I'm completely lost. Could you post a test page? So where exactly is $(#message).get(0).value += window.opener.location.href; running? On Sep 25, 4:29 pm,stinhambo[EMAIL PROTECTED] wrote: Not at the moment. If I put it inside this - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); the popup comes up but the parent also loads the form and no URL gets carried across. On Sep 26, 2:46 am, ricardobeat [EMAIL PROTECTED] wrote: Is this line $(#message).get(0).value += window.opener.location.href; running from inside the popup? On Sep 25, 8:48 am,Stinhambo[EMAIL PROTECTED] wrote: I am having some problems with that bit of code. Basically I am launching a popup window and this is my js file - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); // This passes along the URL of the parent opener when clicking Email this page $(#message).get(0).value += window.opener.location.href; but it seems to be causing a conflict in the rest of my code. My Firebug console log says - $(#message).get(0) is undefined If I comment out the line, everything works nicely. Any idea if I can get rid of this error and still retain the functionality?
[jQuery] Re: Get parent url and add to a textarea
The HTML is - ul id=content_header_tools li id=tools_contact_usa href={path=contact-us/index}Contact Us/a/li li id=tools_email_pagea href={path=email-page/index} rel=email_pageEmail Page/a/li li id=tools_print_pagea href=javascript:window.print();Print Page/a/li /ul and this is part of what sits in my external file - $('a[rel=video_demo]').click(function(){ window.open(this.href,'mywindow','height=460,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); $('a[rel=share_story], a[rel=video_story]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); // This passes along the URL of the parent opener when clicking Email this page $(#message).get(0).value += window.opener.location.href; On Sep 26, 10:31 am, ricardobeat [EMAIL PROTECTED] wrote: Now I'm completely lost. Could you post a test page? So where exactly is $(#message).get(0).value += window.opener.location.href; running? On Sep 25, 4:29 pm, stinhambo [EMAIL PROTECTED] wrote: Not at the moment. If I put it inside this - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); the popup comes up but the parent also loads the form and no URL gets carried across. On Sep 26, 2:46 am, ricardobeat [EMAIL PROTECTED] wrote: Is this line $(#message).get(0).value += window.opener.location.href; running from inside the popup? On Sep 25, 8:48 am, Stinhambo [EMAIL PROTECTED] wrote: I am having some problems with that bit of code. Basically I am launching a popup window and this is my js file - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); // This passes along the URL of the parent opener when clicking Email this page $(#message).get(0).value += window.opener.location.href; but it seems to be causing a conflict in the rest of my code. My Firebug console log says - $(#message).get(0) is undefined If I comment out the line, everything works nicely. Any idea if I can get rid of this error and still retain the functionality?
[jQuery] Re: Get parent url and add to a textarea
I am having some problems with that bit of code. Basically I am launching a popup window and this is my js file - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); // This passes along the URL of the parent opener when clicking Email this page $(#message).get(0).value += window.opener.location.href; but it seems to be causing a conflict in the rest of my code. My Firebug console log says - $(#message).get(0) is undefined If I comment out the line, everything works nicely. Any idea if I can get rid of this error and still retain the functionality?
[jQuery] Re: Toggle Only the dd below the dt on click
I didn't realise .nextAll existed! I was using this - $(dt.solution).click(function() { // This is for toggling multiple dd elements var obj = $(this).next(); // when you click dt.solution while (obj.is(dd)) { // it captures the next element (dd) as a variable obj.toggle(); // then until the next element ceases to be a dd obj = obj.next(); // it toggles the element contained in the variable (dd) } // then it flips onto the next one! return false; }); On Sep 19, 6:58 pm, tobaco [EMAIL PROTECTED] wrote: try it this way: script type=text/javascript $(function(){ $('[EMAIL PROTECTED]http://;]').attr('target', '_blank'); $('[EMAIL PROTECTED]https://;]').attr('target', '_blank'); $(.stripes dd).hide(); $(.stripes dt).click(function(){$ (this).nextAll(dd).toggle(slow); }); }); /script On 19 Sep., 05:24, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: This is probably a noob question but... I have a bunch of definition lists on a page with the same class so that I can stripe every other dd in the list. What I want to do is hide the dd elements and when I click on the dt toggle the dd elements to visible. I want this to happen only on the dd elements in the same definition list as the title I am clicking, not all the dd elements on the entire page. What is happening now is that all of the dd in all of my definition lists are being toggled when I click on any of the dt elements on the page. I am sure this is a simple solution, but I can't seem to wrap my head around it. The code is below. script type=text/javascript $(function(){ $('[EMAIL PROTECTED]http://;]').attr('target', '_blank'); $('[EMAIL PROTECTED]https://;]').attr('target', '_blank'); $(.stripes dd).hide(); $(.stripes dt).click(function(){$(.stripes dd).toggle(slow); });}); /script Thanks for your help! -Paul
[jQuery] Re: Problem jQuery Selecting Input field
Try an underscore in the ID instead. Looks like jQuery is getting confused with the colon being a selector. $(#test_name).mask() should be good enough On Sep 25, 11:28 pm, Faisal Basra [EMAIL PROTECTED] wrote: Hi, I am unable to select the input filed based on ID, i am using JSF and that append form id with the input id automatically. like this and input type=text id=test:name how to select input id(test:name) in jQuery the input field whose id is test:name The, complete code is given below. Please anyone can help, will be thankful. jQuery.noConflict();(function($) { $(function() { jQuery.mask.addPlaceholder('~','[+-]'); $('#date').mask('99/99/'); }); })(jQuery); form id=test input type=text id=test:name /form
[jQuery] Re: Get parent url and add to a textarea
Not at the moment. If I put it inside this - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); the popup comes up but the parent also loads the form and no URL gets carried across. On Sep 26, 2:46 am, ricardobeat [EMAIL PROTECTED] wrote: Is this line $(#message).get(0).value += window.opener.location.href; running from inside the popup? On Sep 25, 8:48 am, Stinhambo [EMAIL PROTECTED] wrote: I am having some problems with that bit of code. Basically I am launching a popup window and this is my js file - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); // This passes along the URL of the parent opener when clicking Email this page $(#message).get(0).value += window.opener.location.href; but it seems to be causing a conflict in the rest of my code. My Firebug console log says - $(#message).get(0) is undefined If I comment out the line, everything works nicely. Any idea if I can get rid of this error and still retain the functionality?
[jQuery] Get parent url and add to a textarea
Hi all! I have some js that opens a popup window based on the rel attribute - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); But what I want to achieve is to pass the parent url (window.opener.href?) to the popup window and append the URL to the contents of a textarea - textarea id=message name=message rows=18 cols=40I wanted to send you a link to - ** ADD URL HERE ** /textarea Any ideas?
[jQuery] Re: Toggle Script not working in IE6
Thanks Karl! I created a separate list for the first dl and so I have an unorder list followed by a definition list. Works very well now :) Now to sort out more problems with jQuery (well more like problems with my knowledge)... On Sep 12, 1:43 am, Karl Swedberg [EMAIL PROTECTED] wrote: From what I can tell from the spec, it looks like the only valid child elements of a dl are dt and dd.http://www.w3.org/TR/html401/struct/lists.html#h-10.3 Perhaps that's the problem? Have you run your page through an HTML validator? If not, try this one:http://validator.w3.org/ --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Sep 11, 2008, at 1:41 AM, Stinhambo wrote: Hi all, I have been wrestling with this all day and finally found a solution only to find it doesn't work in IE6! Here is my HTML - [code] dl dt class=sectiona href=Solutions by Business Need/a/dt dl dt class=solutiona href=Solution 1/a/dt dda href=Product Name #1/a/dd dda href=Product Name #2/a/dd dda href=Product Name #3/a/dd dt class=solutiona href=Solution 2/a/dt dda href=Product Name #1/a/dd dda href=Product Name #2/a/dd dda href=Product Name #3/a/dd /dl /dl [/code] And here is the jQuery - [code] $(document).ready(function() { $(dt.section).click(function(){ $(this).next().toggle(); $(this).toggleClass(open); return false; }); $(dt.solution).click(function() { var obj = $(this).next(); while (obj.is(dd)) { obj.toggle(); obj = obj.next(); } return false; }); }); [/code] What is does is opens the first dt (dt.section) to reveal the nested definition list inside. From there you can click dt.solution and this reveals all the dd elements relating to that dt. It works great in Safari and FF but not IE6 or IE7. Can anyone tell me why this wouldn't work?
[jQuery] Re: Get parent url and add to a textarea
I managed to achieve what I wanted with this - document.getElementById('message').value += window.opener.location.href; in the jquery file but I can't work out the proper jquery way. I'd love to know! On Sep 23, 9:42 pm, Stinhambo [EMAIL PROTECTED] wrote: Hi all! I have some js that opens a popup window based on the rel attribute - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); But what I want to achieve is to pass the parent url (window.opener.href?) to the popup window and append the URL to the contents of a textarea - textarea id=message name=message rows=18 cols=40I wanted to send you a link to - ** ADD URL HERE ** /textarea Any ideas?
[jQuery] Re: Get parent url and add to a textarea
Wow that's great and it works too! What is the square bracket and zero for? On Sep 23, 11:14 pm, BB [EMAIL PROTECTED] wrote: The smallest thing would be: $(#message)[0].value += window.opener.location.href; On 23 Sep., 15:09, Stinhambo [EMAIL PROTECTED] wrote: I managed to achieve what I wanted with this - document.getElementById('message').value += window.opener.location.href; in the jquery file but I can't work out the proper jquery way. I'd love to know! On Sep 23, 9:42 pm, Stinhambo [EMAIL PROTECTED] wrote: Hi all! I have some js that opens a popup window based on the rel attribute - $('a[rel=email_page]').click(function(){ window.open(this.href,'mywindow','height=580,width=400,scrollTo,resizable=0,scrollbars=0,location=0','false'); return false; }); But what I want to achieve is to pass the parent url (window.opener.href?) to the popup window and append the URL to the contents of a textarea - textarea id=message name=message rows=18 cols=40I wanted to send you a link to - ** ADD URL HERE ** /textarea Any ideas?
[jQuery] Toggle Script not working in IE6
Hi all, I have been wrestling with this all day and finally found a solution only to find it doesn't work in IE6! Here is my HTML - [code] dl dt class=sectiona href=Solutions by Business Need/a/dt dl dt class=solutiona href=Solution 1/a/dt dda href=Product Name #1/a/dd dda href=Product Name #2/a/dd dda href=Product Name #3/a/dd dt class=solutiona href=Solution 2/a/dt dda href=Product Name #1/a/dd dda href=Product Name #2/a/dd dda href=Product Name #3/a/dd /dl /dl [/code] And here is the jQuery - [code] $(document).ready(function() { $(dt.section).click(function(){ $(this).next().toggle(); $(this).toggleClass(open); return false; }); $(dt.solution).click(function() { var obj = $(this).next(); while (obj.is(dd)) { obj.toggle(); obj = obj.next(); } return false; }); }); [/code] What is does is opens the first dt (dt.section) to reveal the nested definition list inside. From there you can click dt.solution and this reveals all the dd elements relating to that dt. It works great in Safari and FF but not IE6 or IE7. Can anyone tell me why this wouldn't work?