When I execute this code, my jquer开发者_JAVA技巧yui modal form closes. Why does it do this?
$(document).ready(function() {
$('#mylink').click(function(){
$('#textfield').val = '';
});
});
mylink is defined like this:
<a href"" id="mylink">My Link</a>
Try $('#textfield).val('');
That's normally how you set the value.
you need to return false in the click function to prevent the page from posting back
精彩评论