mathiasbynens / jquery-placeholder

A jQuery plugin that enables HTML5 placeholder behavior for browsers that aren’t trying hard enough yet
https://mths.be/placeholder
MIT License
3.98k stars 1.34k forks source link

in IE 7-9 <a> element's default event will cause the placeholder's value be '' #287

Closed yangblink closed 8 years ago

yangblink commented 8 years ago

if the element with an attribute href javascript:; or javascript:(0); html

<body>
    <input type="text" name="name" placeholder-x="e.g. John Doe" id="yqb">
    <div id="awrap">
        <a id="mya1" href='#'>dian wo</a>
        <a id="mya2" href='javascript:;'>dian wo2</a>
    </div>
</body>

js

$(function() {
    $('input, textarea').placeholder();
})

when you click the a element the placeholder's value will be ''

i use event.preventDefault() solve it

yangblink commented 8 years ago

74