The function should be in the global scope
, if it's in an inner scope it's not accessible to the onclick=...
:
<script type="text/javascript">
function saveChanges () {
tinyMCE.triggerSave();
}
</script>
or with jQuery:
<a class="btn btn-primary"> Save changes</a>
<script type="text/javascript">
$(function(){
$('.btn-primary').click(function(){
tinyMCE.triggerSave();
});
});
</script>
It would be a good idea to give the <a>
an id
like this:
<a id="theAnchor"> Save changes</a>
Then...
$(function(){
$('#theAnchor').click(function(){
tinyMCE.triggerSave();
});
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…