So that jQuery recognises your function, it needs to be added to $.fn.
$.fn.condchan = function() { };
this then gives you access to this which would be the current jquery context, eg:
$.fn.myFunc = function(txt) { var that = this; setTimeout(function() { that.text(txt) }, 500); };
$("#div").myFunc("changed");
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id='div'>text</div>
In order to add chaining you simply need to return this. You can also use $(this).each... if you want to do anything more than a bulk operation, eg:
$.fn.myFunc = function(txt) {
// this = jquery context
$(this).each(function(i, e) {
// this now = loop iteration
var that = $(this);
setTimeout(function() { that.text(txt) }, 500 * (i + 1));
});
return this;
};
$(".div").myFunc("changed").css("color", "red");
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class='div'>text</div>
<div class='div'>text</div>
There's more you can do to create a fully fledged reusable plugin and this page should be your starting point: https://learn.jquery.com/plugins/basic-plugin-creation/