0
基本的には、クラス名が異なるこれらのボタンとテキストエリアが少なくとも20個以上あります。複数のjQueryボタントグルでDRYアプローチを適用する方法
<textarea class="widefat res_editor_exp2wid1" rows="10" cols="20" style="display: none;" id="<?php echo $this->get_field_id('jd1'); ?>" name="<?php echo $this->get_field_name('jd1'); ?>"><?php echo esc_attr($instance['jd1']); ?></textarea>
<button class="res_editor_btn_exp2wid1" type="button">Edit Content</button>
私がやっていることは、ボタンをクリックしてテキストエリアを拡大することです。これにより -
jQuery(document).on('click', '.res_editor_btn_exp2wid1', function(){
jQuery(".res_editor_exp2wid1").toggle("slow").click(function(){
jQuery('.res_editor_exp2wid1').trumbowyg();
});
});
たびに、私はちょっと面倒です。このjQueryのを記述する必要があり、私はそれDRYアプローチしたいです。私はそれをどのように達成できますか?申し訳ありませんがばかげて聞こえる場合、私はこの問題ではかなり初心者です。どんな助けもありがとう。
コメントをいただきありがとうございます、私はこれを実装して、あなたに連絡します –