How to add new html attribute maxlength="10" to street input field on shipping address form.
Thanks
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityHow to add new html attribute maxlength="10" to street input field on shipping address form.
Thanks
I achieved this with below code
require(['jquery', 'jquery/ui'], function($){
jQuery(document).ready( function() {
var existConditionZero = setInterval(function() {
if (jQuery("input[name='street[0]']").length > 0) {
clearInterval(existConditionZero);
runMyFunctionZero();
}
}, 100);
function runMyFunctionZero(){
jQuery('input[name="street[0]"]').attr("maxlength","10");
}
});
});
require(['jquery', 'jquery/ui'], function($){
jQuery(document).ready( function() {
var existConditionOne = setInterval(function() {
if (jQuery("input[name='street[1]']").length > 0) {
clearInterval(existConditionOne);
runMyFunctionOne();
}
}, 100);
function runMyFunctionOne(){
jQuery('input[name="street[1]"]').attr("maxlength","10");
}
});
});