JQuery intercept tugmasini bosing

Menda bu skript bor

$('#addDescriptionButtonId').click(function(){
        alert ('ee');           
    });

va ushbu tugmani bosing

<button id="addDescriptionButtonId" class="btn btn-primary"  type="submit">Add Description</button> 

Men bosganimda ogohlantirishni kutmoqdaman, lekin bosganimda hech narsa bo'lmaydi

1
Siz sahifaga jQuery qo'shganingizga ishonchingiz komilmi? Sizning kodingiz yaxshi.
qo'shib qo'ydi muallif Slime, manba

8 javoblar

jQuery kutubxonasini qo'shishingiz kerak

<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code">

$('#addDescriptionButtonId').click(function(){
        alert ('ee');
        $('#productFormId').attr('method', 'post');
    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="addDescriptionButtonId" class="btn btn-primary"  type="submit">Add Description</button>
</div> </div>
0
qo'shib qo'ydi

jQuery kutubxonasini qo'shishingiz kerak

<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code">

$('#addDescriptionButtonId').click(function(){
        alert ('ee');
        $('#productFormId').attr('method', 'post');
    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="addDescriptionButtonId" class="btn btn-primary"  type="submit">Add Description</button>
</div> </div>
0
qo'shib qo'ydi

jQuery kutubxonasini qo'shishingiz kerak

<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code">

$('#addDescriptionButtonId').click(function(){
        alert ('ee');
        $('#productFormId').attr('method', 'post');
    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="addDescriptionButtonId" class="btn btn-primary"  type="submit">Add Description</button>
</div> </div>
0
qo'shib qo'ydi

Make sure your script is either running in $(document).ready() or is at the end of your <body>.

0
qo'shib qo'ydi

Make sure your script is either running in $(document).ready() or is at the end of your <body>.

0
qo'shib qo'ydi

Make sure your script is either running in $(document).ready() or is at the end of your <body>.

0
qo'shib qo'ydi

Xo'sh, agar biron bir jQuery kutubxonasini qo'shmasligingiz va ogohlantirish tugmachasida ishlashni xohlamasangiz, quyida keltirilgan tugmani bosish orqali mahalliy "OK" tugmasini bosing.

Javascript:

var element = document.getElementById('addDescriptionButtonId');
element.onclick = myFunction;

function myFunction() {
   alert("ee");
}

HTML:

<button id="addDescriptionButtonId" class="btn btn-primary"  type="submit">Add Description</button> 

Umid qilamanki bu sizga yordam beradi.

0
qo'shib qo'ydi

Xo'sh, agar biron bir jQuery kutubxonasini qo'shmasligingiz va ogohlantirish tugmachasida ishlashni xohlamasangiz, quyida keltirilgan tugmani bosish orqali mahalliy "OK" tugmasini bosing.

Javascript:

var element = document.getElementById('addDescriptionButtonId');
element.onclick = myFunction;

function myFunction() {
   alert("ee");
}

HTML:

<button id="addDescriptionButtonId" class="btn btn-primary"  type="submit">Add Description</button> 

Umid qilamanki bu sizga yordam beradi.

0
qo'shib qo'ydi
Javascript UZB
Javascript UZB
99 ishtirokchilar

@js_uzb @vuejs_uz @react_uz @nodejs_uz @angular_uz @ngTashkent @yiiframework_uz @laravel_uz @linux_uzbek @python_uz @swift_uzb —————— @uzdevgroup @UzGeeksGroup ——— @UzDev_Jobs @jobs_uzb