Creating plugins
Creating plugins
I'm relatively new to jQuery, and love it. The only thing I'm having a problem with is transforming simple functions into plugins. I've got some code that will do an inline search and show only the LI's that match what was put into the #search_box.
Could someone please show me how to transform this into a working plug-in?
-
// Extend to add case-insensitive :contains selector
jQuery.extend(jQuery.expr[':'], {
"contains-ic": "jQuery.fn.text.apply([a]).toLowerCase().indexOf(m[3].toLowerCase())>=0"
});
// Process search input to filter out relevant results
$('#search_box').keyup(function() {
$("li").hide();
$("li:contains-ic('"+ $(this).val() + "')").show();
});