Hi,
I’m new to CodeIgniter and I like it a lot.
xwero - 31 January 2008 09:26 PM
do you want the common modal window. The only thing you need is a class
$('[b].delete[/b]').click(function(){
var answer = confirm('Delete user');
return answer // answer is a boolean
});
Thank you xwero.
Using jQuery, I added in CI a class to anchor and it worked.
echo "<td>". anchor('controller/delete/'.$row->id,'Delete',array('class' => 'delete')) ."</td>";
The drawback is that is doesn’t show witch record removes.Maybe adding a ‘title’ to the anchor then showing this in javascript code could do it.
The good is that jQuery is unobtrusive.
PS: I figured out how to get with jQuery anchor attributes
jQuery function
$(document).ready(function(){
$('.delete').click(function(){
var answer = confirm('Delete '+jQuery(this).attr('title'));
// jQuery(this).attr('title') gets anchor title attribute
return answer; // answer is a boolean
});
});
anchor in ci view file
echo "<td>". anchor('controller/delete/'.$row->id,'Delete',array('class' => 'delete', 'title'=>"$row->username")) ."</td>";