0
Я пытаюсь разработать плагин JQuery для серии входных данных для выбора html. Если какие-либо изменения выбора, все последующие выборки будут изменены/перезагружены.Рекурсивный метод в плагине JQuery
Вот HTML -
<select id="first" class="myselect" data-child ="second">...</select>
<select id="second" class="myselect" data-child ="third">..</select>
<select id="third" class="myselect" data-child ="fourth">...</select>
....
$('.myselect').MySelect();
Это мой плагин я был так далеко
(function ($) {
$.fn.MySelect= function() {
return this.each(function() {
var $This = $(this);
var childId = $This.attr('data-child');
$This.change(function (e) {
e.preventDefault();
if (childId !='none') {
var $Child = $('#' + childId);
$Child.Reset(); //Should be Recursive call
}
});
});
};
}(jQuery));
Как я могу сделать это в плагине?
или '$ ребенок. MySelect(); '? – ramabarca