I have included a javascript in the module “myid” I’ve been developing in drupal by using this code:
function myid_init() { drupal_add_js(drupal_get_path("module", "myid") . "js/myid.js"); }
This is my Javascript file “myid.js”:
function myid_js_start(){ alert("hello world"); }
Below is the code that creates a button that invokes an alert function:
$form['add_button'] = array( '#type' => 'button', '#value' => 'Take a picture', '#attributes' => array('onclick' => 'myid_js_start()'), );
I dont know where did I go wrong. The button shows up but doesn’t fire any alert function. Can anyone help me with this?
Sponsored by SupremePR