目前有以下代码,当点击按钮时,我希望它触发某些事件,但是,似乎没有任何事情发生。任何帮助都是有益的:
追加输入按钮:
var row = $("<DIV></DIV>").addClass("row resource").attr("resource", "new");
var label = $("<SPAN></SPAN>").addClass("label imaged").text("New resource");
var spanEl = $("<SPAN> </SPAN>").addClass("defaultJobType");
spanEl.append($("<input id ='setDefaultJobType' type='submit' name='Default' value='Set Default'/>"));
label.append(spanEl);
点击后,它应该进入以下代码:
$("#setDefaultJobType", context).click(function() {
clickedDefaultJob($(this));
});
以下哪些触发器:
function clickedDefaultJob($el) {
//Remove bold tags from previous job type
$("div.row.ordertype").each(function(){
if(($(this).text()).length>0){
$("strong").contents().unwrap();
}
})
//assign default bold text to selected job type
var row = $el.closest(".row");
var rowNumber = row.attr("key");
var defaultVal = row.find(".defaultVal INPUT");
var jobTypeNameEl = $el.closest(".label.imaged");
jobTypeNameEl.wrapInner("<strong />");
var value = jobTypeNameEl.text();
updateSetting("<%=Setting.SET_DEFAULT_JOBTYPE%>", rowNumber, "int");
}