tags:

views:

47

answers:

1

in my code for index.html I use jQuery and have a link with id #button3.

I have used in index.html

 $('#button3 a').attr({
                            target: '_top'
                        });

When I call the index.html from an iframe as a src, the page opens in _self. I have tried with _blank and still when clicking on the a link it doesn't open on a new page. Any tips?

I have this code

 //handle click OK button
                $("#button3").click(function(){
                    if (validate()) {
                        submitQuery();
                    }
                });

                        //set the target attribut to return to the parent

                       $('#button3 a').attr('target', '_parent');

and 2 functions validate and submitQuery don't call the a link at any time.

+1  A: 

The correct set-attribute syntax is:

$('#button3 a').attr('target', '_top');
Diodeus
Thank you for quick reply, I have tried that and it doesn't work. I have even tried on the main index.html button with no luck
digitup
See if you have the correct element, try putting a border on it:$('#button3 a').css('border', '1px solid #ff0000');
Diodeus
@Diodeus, I appreciate your help. It still doesn't happen. I have other jquery code in the same page. Can this cause any issues?If you would like I can provide you with a link if you don't mind in PM. Thanks
digitup
Yeah, need to see you HTML.
Diodeus
hmm, couldn't find any PM system on stackoverflow!!
digitup
Just edit your question, paste in your code.
Diodeus
I have just added some more code. Thanks for all the help.
digitup