Tharindu Kalubowila
Tharindu Kalubowila

Reputation: 1

how to add normal script code to view.ctp in CakePHP 2.2.4

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

Upvotes: 0

Views: 179

Answers (1)

Skatch
Skatch

Reputation: 2272

  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.

Upvotes: 1

Related Questions