Как можно остановить кнопку с помощью JQuery

0

Я хочу знать, как можно остановить кнопку

Когда до (*)

Вот

HTML

<table id='a' border='2'>
    <tr>
        <td>1 = <input type='submit' value='send' onclick=' fs (this)'/></td>
    </tr>
    <tr>
        <td>2 = <input type='submit' value='send' onclick=' fs (this)' /></td>
    </tr>
    <tr>
        <td>*3 = <input type='submit' value='send' onclick=' fs (this)'/></td>
    </tr>
    <tr>
        <td>4 = <input type='submit' value='send' onclick=' fs (this)'/></td>
    </tr>
    <tr>
        <td>5 = <input type='submit' value='send' onclick=' fs (this)' /></td>
    </tr>
</table>

</body>

jQuery скрипта

function fs(el){
    alert("hello");
}

$(function(){
    $("#a tr").each(function(i ,v){
        setTimeout(function() {
            $(v).find(":submit").click();
        }, (i + 1)* 500);

               var click = $(this).find("td:eq(0)").text().match(/\*/);
        if(click == '*'){
            $(v).find(":submit").attr("disabled","disabled");


        }
    });
});

Вот

<td> * 3 = <input type='submit' value='send' onclick=' fs (this)'/> </ td>

Необходимо остановить все кнопки ниже, когда он (*)

<td> 4 = <input type='submit' value='send' onclick=' fs (this)'/> </ td>
<td> 5 = <input type='submit' value='send' onclick=' fs (this)'/> </ td>

Но не остановилась, но она работает, когда он (*)

("привет");

Как остановить все кнопки, когда он добирается до * Я хочу, чтобы я остановил все кнопки под (*)

<td> * 3 = <input type='submit' value='send' onclick=' fs (this)'/> </ td>
<td> 4 = <input type='submit' value='send' onclick=' fs (this)'/> </ td>
<td> 5 = <input type='submit' value='send' onclick=' fs (this)'/> </ td>

и спасибо =)

Теги:

1 ответ

0

Вы можете создать условие в своей функции следующим образом:

    function fs(el) {
        var value = el.attr('disabled');
        if (value) {
            el.preventDefault();
            return false;
        }
    }

Надеюсь, это поможет.

Ещё вопросы

Сообщество Overcoder
Наверх
Меню