我正在尝试编写一个简单的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)