Modify ↓
Ticket #2770 (closed bug: wontfix)
Can't change attr type to 'search' in Safari 3
| Reported by: | codyx | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.2.4 |
| Component: | core | Version: | 1.2.3 |
| Keywords: | attribute attr safari search | Cc: | |
| Blocking: | Blocked by: |
Description
Taken from mailing list, posted by Claudio Procida:
Apparently, jQuery can't set the "type" attribute of html input fields to look like Cocoa search fields in Safari. jQuery version: 1.2.3 Safari version: 3.1 (525.13) Proof follows:
<html>
<head>
<script src="jquery-1.2.3.min.js"></script>
<script>
$(function() {
// this works:
//document.getElementById('s_f').setAttribute('type', 'search');
// these don't work:
$('#s_f').attr('type', 'search');
$('#s_f').attr({type: 'search'});
});
</script>
</head>
<body>
<input type="text" id="s_f" />
</body>
</html>
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

jQuery doesn't support setting the type attribute. There are just too many problems and input elements are not meant to change type. The best you can do is remove the element and replace it with a new element of the desired type.