I might be making a very simple mistake but am having some serious trouble tring to figure out why it’s not working.
Here’s the code: http://jsfiddle.net/HthCa/
UPDATE: this is my actual code..
<script type="text/javascript" src="scripts.js"></script>
<script type="text/javascript">
$(function() {
$('#test').customTabs();
})
</script>
scripts.js
$.fn.customTabs = function() {
alert($(this).html());
}
In your code:
You’re calling
$.fn.customTabs()before defining it. Try instead:Note that you do not need to apply
$tothisin a plugin method, asthisis already a jQuery object (the one on which the method was called).