Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
<Hey all,
ive been trying to get my code to target and iframe and when it does so the iframe:
JavaScript
$('iframe').show();
the iframe is currently
JavaScript
$('iframe').hide();

well the story is that im using google search API and I want the result(when clicked) to target my iframe:
HTML
<a href="',r.unescapedUrl,'" target="window1"> 

Now it DOES target the iframe, But when I:
JavaScript
$('a').click(function(){
$('iframe').show();
});

nothing happends?
it wont show my iframe?

the result page is coded with jquery:
JavaScript
case 'GwebSearch':
arr = [

'<div class="webResult">',
'<h2><a href="',r.unescapedUrl,'" target="window1">',r.title,'</a></h2>',
'<p>',r.content,'</p>',
'<a href="',r.unescapedUrl,'" target="window1">',r.visibleUrl,
'</a>',
'</div>',

];

is this effecting my code?
is there any way of writing a code to check if the iframe is being targeted?

any help will do, thanks
Posted
Updated 3-Feb-12 19:14pm
v2

I would put an alert in that click function to make sure it was being called, or use Chrome to put a breakpoint in the code, to see what was going on.
 
Share this answer
 
Comments
Jrop 5-Feb-12 0:52am    
how would a achieve this?
sorry im not so good at Jquery im still learning,

$('a').click(function() {
alert
$('iframe').show();
});
use can use either Chrome or
built in debugger of Windows Explorer 7 or 8
or Firefox-Firebug or Visual Studio 2008/2010

<u>follow this steps....</u>

Visual Studio 2010 comes with debugger tool for javascript/ jquery. To enable Javascript debugger in Visual Studio, do the following:

Enable Script debugging in Internet Explore:

Click on Tools -> Internet Options -> Advanced tab -> Browsing.
Clear “Disable Script Debugging” check box.
Click ok and restart IE.
Using script debugging in Visual Studio 2010.

Write your script.
At beginning of your script add the below line:
debugger;

Run debug in Visual Studio, code will stop at “debugger” line and you can start debug from here.
From this point on, you can also set breakpoint on your script.
Good luck.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900