Reputation: 708
I need to load fancybox with inside php file, when I will click on textarea.
My code:
<script type="text/javascript">
$("#mypop").click(function() {
$.fancybox({
'href' : 'file.php',
'transitionIn' : 'none',
'transitionOut' : 'none',
'titleShow' : false,
'overlayColor' : '#fff',
'overlayOpacity': 0.8 }); });</script>
<textarea rows="4" cols="50" onfocus="#mypop" ></textarea>
Why this is not working ?
Upvotes: 0
Views: 582
Reputation: 1
<script type="text/javascript">
$("#mypop").click(function() {
$.fancybox("<iframe src='file.php' frameborder='0'></iframe>",
{
maxWidth : 700,
maxHeight : 600,
fitToView : false,
width : '50%',
height : '50%',
autoSize : true,
closeClick: false
});
});
</script>
<textarea rows="4" cols="50" id="mypop" ></textarea>
By: Jose ALfredo Cocom Chan
Upvotes: 0
Reputation: 8053
You need to change your textarea tag: remove onfocus="#mypop"
and add id="mypop"
. The $("#mypop")
function-call will search for an element with id="mypop"
, and the click(function(){...})
function will add the event-listener. This function-call also makes the onfocus=
-attribute unnecessary.
Upvotes: 1