I have a script inside of my HTML file. For example
<div id='mydiv'>Hello World</div>
<script>
$(document).ready(function(){
var newtext = 'Bye-bye world';
$('#mydiv').html(newtext);
});
</script>
Now I'd like to move the script to external file and make so, that user can define which html to add to which div. For example
<div id='mydiv'>Hello World</div>
<script>
$(document).ready(function(){
$('#mydiv').changetext({
'newtext':'My new text'
});
});
</script>
How can it be done? Thx