First, get rid of these tables in h3. Use divs with css:
<style>
.ui-accordion2-header .tools{
position: absolute;
right: 10px;
top: 10px;
width: 345px;
}
.ui-accordion2-header .tools a {
width: auto;
display: inline;
}
</style>
<div id="accordion" class="ui-accordion2-group">
<h3 class="ui-accordion2-header" data-sectionid="1">
<a href="#">Section Title</a>
<div class="tools">
<a href="#" class="newactivity">New Activity</a>
<a href="#" class="edit">Edit</a>
<a href="#" class="delete">Delete</a>
</div>
</h3>
<div>
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam.</p>
</div>
</div>
Secondly, there is no need to add events to the line up, top:
<script type="text/javascript">
$(function() {
$("#accordion").accordion({
alwaysOpen: false,
active: false,
autoheight: false,
clearStyle: true
}).find('.tools a').click(function(ev){
ev.preventDefault();
ev.stopPropagation();
var $obj = $(this);
var sectionid = $obj.closest('h3').attr('data-sectionid');
if ($obj.hasClass('newactivity')){
toggel_new_activity(sectionid);
} else if ($obj.hasClass('edit')){
edit(sectionid);
} else if ($obj.hasClass('delete')){
delete(sectionid);
}
});
});
</script>
ev.preventDefault() , , "a".
ev.stopPropaggation() click
, .