Hello
Here I saw you how to run jQuery in phtml file.
**********************************************************************
****************************************************************
<script type="text/javascript">
//<![CDATA[
require(
[
'jquery',
'Magento_Ui/js/modal/modal'
],
function(
$,
modal
)
{
var options = {
type: 'popup',
responsive: true,
innerScroll: true,
title: 'Qty Estimator',
buttons: [{
text: $.mage.__('Continue'),
class: '',
click: function () {
this.closeModal();
}
}]
};
var popup = modal(options, $('#popup-modal'));
$("#click-me").on('click',function(){
$("#popup-modal").modal("openModal");
});
$('#rate, #box').keyup(function(){
var rate = parseFloat($('#rate').val());
var box = parseFloat($('#box').val());
$('#amount').val(rate * box);
var amount = rate * box;
if(amount != null || amount != undefined) {
$('#amount2').val(amount / 20);
}
});
}
);
//]]>
</script>
Here I saw you how to run jQuery in phtml file.
<script type="text/javascript">
//<![CDATA[
require([
'jquery'
], function($) {
setTimeout(function() {
$( "#iwd_opc_shipping_method" ).append( "<div class='iwd_opc_section_delimiter'></div>" );
$( "#iwd_opc_discount" ).insertAfter( "#onepage-checkout-shipping-method-additional-load" )
}, 2500);
//$( "#iwd_opc_discount" ).insertAfter( "#onepage-checkout-shipping-method-additional-load" )
}
);
//]]>
</script>
**********************************************************************
<script type="text/javascript">
//<![CDATA[
require([
'jquery',
'Magento_Ui/js/modal/alert'
], function($, alert) {
$('#id-of-element').on('click', function(event){
alert({
content: $(event.target).parent().val()
})
})
}
);
//]]>
</script>****************************************************************
<script type="text/javascript">
//<![CDATA[
require(
[
'jquery',
'Magento_Ui/js/modal/modal'
],
function(
$,
modal
)
{
var options = {
type: 'popup',
responsive: true,
innerScroll: true,
title: 'Qty Estimator',
buttons: [{
text: $.mage.__('Continue'),
class: '',
click: function () {
this.closeModal();
}
}]
};
var popup = modal(options, $('#popup-modal'));
$("#click-me").on('click',function(){
$("#popup-modal").modal("openModal");
});
$('#rate, #box').keyup(function(){
var rate = parseFloat($('#rate').val());
var box = parseFloat($('#box').val());
$('#amount').val(rate * box);
var amount = rate * box;
if(amount != null || amount != undefined) {
$('#amount2').val(amount / 20);
}
});
}
);
//]]>
</script>
No comments:
Post a Comment