jQuery - Create hidden form element on the fly

Source: https://stackoverflow.com/questions/2408043/jquery-create-hidden-form-element-on-the-fly

$('<input>').attr('type','hidden').appendTo('form');
To answer your second question:
$('<input>').attr({
    type: 'hidden',
    id: 'foo',
    name: 'bar'
}).appendTo('form');
The same as David's, but without attr()
$('<input>', {
    type: 'hidden',
    id: 'foo',
    name: 'foo',
    value: 'bar'
}).appendTo('form');

Không có nhận xét nào:

Is it okay to use both fetchpriority="high" and loading="eager" in img tag?

 https://stackoverflow.com/questions/77744344/is-it-okay-to-use-both-fetchpriority-high-and-loading-eager-in-img-tag Yes Fetchpriority and l...