jqueryでプロパティを変更するプラグインを作ろうと考えているのですが、オプションの書き換えの辺りでの使い方で困っています。
以下で使い方宜しいでしょうか?
下記コアファイルソース:
(function($){
$.fn.empty_alt = function(options){
var options = $.extend(function(){ 'nothing':'Image nothing' }); return this.each(function(){ var $this = $(this); if($this.attr('alt') === ""){ $this.attr('alt', options); } });
};
})(jQuery);
USE:
jQuery('img').empty_alt({
'nothing':'画像が指定されていません。'
});
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。