My problem is that I want to set the default value of the search box and to filter according to the conditions which I setted when I Initialize the page. $("#table_id_filter input").val("man"); //set the default value of the search box
$("#table_id_filter input").val("man"); //set the default value of the search box
But it does't work,I must click the search box and do someting(for example add a space),then it can filter.
I use the .focus() function to make the input be focused when the page load, and it works,but the fifter don't excute, I must to excute one keyEvent then it can filter.I want to know if I can invoke the filter function again when the input has be focused.
If I want to finish this function,how? Can you helo me? Thank you!
As "Guruprasad Rao" Suggested in the comments trigger focus on page load, see code below:
<!DOCTYPE html>
<html>
<body>
<form>
First name: <input type="text" name="fname" autofocus><br>
Last name: <input type="text" name="lname"><br>
<input type="submit">
</form>
<p><strong>Note:</strong> The autofocus attribute of the input tag is not supported in Internet Explorer 9 and earlier versions.</p>
</body>
</html>
Heres a working example:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.