0

enter code hereI want to insert this code to my .ctp file

<script> $(document).ready(function(){ $('open').click(function(){ $('#pop_background').fadeIn(); $('#pop_box').fadeIn(); return false; }); }); </script> 

it should work with this

<a href="#" id="open">Open popup box</a> I have created the relevant CSS files and div for 'pop_background' and 'pop_box'. Now it should be appeared when I click the 'open popup box' link. how can I do this in CakePHP

3
  • You can just paste somewhere on the (e.g. at the end of the) ctp file, in this case you can look at ctp file as a usual html/php file Commented Jun 13, 2015 at 7:32
  • btw, your event is for clicking on open tag, I assume you wanted to have open class - .open or open id #open Commented Jun 13, 2015 at 7:35
  • Thank you dav for helping me to improve my question. It was very helpful since I am new to here. Commented Jun 13, 2015 at 8:03

1 Answer 1

1
  1. Check if you have loaded jQuery in your layout (include it in the head of the document if you want it to work like this)
  2. It's $('#open'), not $('open'). Use jQuery selectors just like in css.
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for giving me the support, I added <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> in top of file. Then it was done.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.