Into elungileyo malunga ne-jQuery kukuba sinokwandisa ithala leencwadi ngokulula, kwaye namhlanje siza kuyandisa ukongeza umsebenzi oza kusivumela ukuba sinciphise elona nani liphezulu leebhokisi zokutshekisha, into enomdla ngokwenene.
Inyathelo lokuqala: Yongeza umdaCheckbox umsebenzi kwi-jQuery:
$ .fn.limitarCheckbox = umsebenzi (num) {var khangela = oku;
this.click (function () {return (check.filter (": checked"). ubude <= num);}); / * Sithatha inani lokutshekishwa kwaye sijonge ukuba ziyadlula kwiparameter * /}
Inyathelo lesibini: Senza umsebenzi kuxwebhu.
$ ("Igalelo: ibhokisi yokukhangela"). LimitCheckbox (6);/ * Singasebenzisa nawuphi na umkhethi ukuba nje uneebhokisi zokukhangela ... kwaye ungayikhawulela kuyo nantoni na oyifunayo * /
Ndiyathemba ukuba iyakunceda kwiprojekthi, kuye kwafuneka ndiyenze ngokungxamisekileyo ngoku kwaye andinakukunceda kodwa ndikuthumele yona, ziyilo zehlabathi!
ungakhankanya enye into efana nayo? nayiphi na eminye imizekelo yekhowudi?
ENKULU!, Enkosi ngegalelo, ndiqala nge-php, jQuery kunye neJavaScrit kwaye undincede ndayiqonda indlela yokuyisebenzisa kweminye imisebenzi, enkosi !!