Add Javascript to a single page

I need to add a small piece of Javadscript to a single page with drupal_add_js. I understand there are better ways to do this sort of thing ( e.g changes to template files/behaviours) but I was hoping to get away with a less involved route. Just to see how this might work I tried this code in a php enabled page.

<?php

drupal_add_js("
jQuery(document).ready(function(){
    jQuery('p').click(function(){
        alert('The paragraph was clicked.');
    });
})");

?>
<p>Click on this paragraph.</p>

This code works fine when included in a standalone html page with script tags etc.

However in Drupal. clicking the paragraph does nothing. Is this approach ok or is it doomed to failure ! Thanks.

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/4/feed