I am trying to write a simple Javascript snippet into a Codeigniter link. I am using the link to delete posts where required in my dashboard. I dont know anything about JS although am trying to learn it.
Code
$js = 'onClick = "alert("Are you sure")"';
$this->table->set_heading('Date', 'Title', 'Delete', 'Update');
foreach($records as $row){
$row->title = ucwords($row->title);
$this->table->add_row($row->date,
$row->title = ucwords($row->title),
anchor("main/delete/$row->id", $row->id, $js), //this is the link in question
anchor("main/fill_form/$row->id", $row->id)
);
}
$table = $this->table->generate();
echo $table;
My question is how to write the JS for the link ($js). I would like to use a confirm statement, (yes or no). I am totally lost with JS to prevent accidental deletions
Thank you