Home > Web Front-end > HTML Tutorial > The difference and precautions between button and input type=button_HTML/Xhtml_Web page production

The difference and precautions between button and input type=button_HTML/Xhtml_Web page production

WBOY
Release: 2016-05-16 16:40:38
Original
2312 people have browsed it
tags is the content of the button, including any acceptable body content, such as text or multimedia content. For example, we can include an image and associated text in a button and use them to create an attractive markup image in the button.
The only prohibited element is image mapping, as its mouse and keyboard-sensitive actions interfere with the behavior of form buttons.
Always specify the type attribute for buttons. The default type in Internet Explorer is "button", while the default in other browsers (including the W3C specification) is "submit".
Browser Support
All major browsers support the value through $('#customBtn').val()
This is how it works under IE (IE kernel) The value obtained when using it is "button", not "test". The value obtained under non-IE is "test". Attend the first sentence marked in red above.
This should be distinguished from .
Through these two methods, $('#customBtn').val(), $('#customBtn').attr('value') obtains the value in different browsers, as follows:

Browser/Value

$('#customBtn').val()

$('#customBtn').attr('value')

Firefox13.0

test

test

Chrome15.0

test

test

Opera11.61

test

test

Safari5.1.4

test

test

IE9.0

按钮

按钮


Verify this by testing the code below

Copy the code
The code is as follows:






$(function(){
$('#test1').click(function(){
alert($('#customBtn').attr('value'));
});
$('# test2').click(function(){
alert($('#customBtn').val());
});
});



按钮





2. Inadvertently put the





Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template