【发布时间】:2011-09-30 20:21:00
【问题描述】:
我正在尝试进行自己的 tumblr 搜索(仅限标签),因为他们自己的搜索功能实际上不起作用。
所以我快到了。它有效,但我需要搜索字段来保留用户搜索的值。
所以如果我搜索“foobar”,它会将 tumblr.com/tagged/foobar 直接加载到我的 tumblr.com 中,但搜索字段仍然包含术语“foobar”
这是我的工作代码除了,我试图将上一个搜索词插入新加载的代码中
提前致谢。
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
jQuery(function($) {
$('#syndex').keydown(function(event) {
if (event.keyCode == '13') {
var syndex = $('input:text').val();
$('body').load("http://syndex.me/tagged/"+ syndex);
$(this).val(syndex); //this is what's not working
}
});
});
</script>
</head>
<body>
<div id="logo">
<input id="syndex" type="text"/>
</div>
</body>
</html>
【问题讨论】: