Red de conocimiento informático - Conocimiento informático - ¿Cómo deshabilitar el evento de clic del botón de enlace en easyui?

¿Cómo deshabilitar el evento de clic del botón de enlace en easyui?

Deshabilitar el botón de enlace solo puede deshabilitar el estilo, no el evento de clic.

$('#btn').linkbutton('disable');

Solución:

Primer método:

juqery unbind método

El segundo método:

Juzga el atributo deshabilitado $('#btn').linkbutton('disable');

$( '#btn ').click(función () {

if ($(this).linkbutton('opciones').disabled == false) {

alert('a ')

}

});

Tercer método:

Expandir:

función setDisabled(objetivo, deshabilitado) {

var estado = $.data(target, "linkbutton");

if (deshabilitado) {

opciones.disabled. = verdadero;

var href = $(target).attr("href");

if (href) {

state.href = href ;

$(target).attr("href", "javascript:void(0)");

}

if (target. onclick) {

state.onclick = target.onclick;

target.onclick = null;

}

//Manejo de eventos

var events = $(target).data("events");

if (events){

var clicks = events.click // Actualmente solo clic; los eventos se procesan

state.events = state.events||[];

$.extend(state.events, clicks);

$ (objetivo ).unbind("click");

}

$(target).addClass("l-btn-disabled");

} else {

estado.opciones.disabled = false;

if (estado.href) {

$(objetivo ).attr("href", estado .href );

}

if (estado.onclick) {

target.onclick = estado.onclick;

}

if (estado.eventos) {

for ( var i=0;i

$(target bind(). state.events[i].type,state.events[i].handler);

}

}

$( objetivo) .removeClass("l-btn-disabled");

}

};