小编Vai*_*hav的帖子

Jquery插件 - 陷入困境,事件发生

我正在尝试编写一个简单的jquery插件,其中包含一个textarea或textbox和一些按钮.

单击按钮我需要获取相关textarea或文本框的值.

我写了一些代码,但我陷入了困境.谁能帮我这个?

这是小提琴:http://jsfiddle.net/655wz/

(function ($) {

$.fn.widgetify = function (options) {
    var defaults = {
        multi: false
    };
    var settings = $.extend({}, defaults, options);

    return this.each(function () {
        //create all dom elements here
        this.template = $("<div class='outer' id='" + settings.id + "'>Sample Class</div>");
        this.textbox = $("<input type='text' name='sample' id='sample' />");
        this.textarea = $("<textarea name='sampletextarea' id='sampletextarea'></textarea>");
        this.go = $("<input type='button' name='" + settings.id + "_go' id='" + settings.id + "_go' value='Go' />");

        //append all dom elements here …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery jquery-plugins

2
推荐指数
1
解决办法
102
查看次数

标签 统计

html ×1

javascript ×1

jquery ×1

jquery-plugins ×1