0
我有一个链接,将获得输入(文本)的值,如果不是空的,并将其附加到href值。有没有办法完成它?继承人我的代码。提前致谢。所有的如何将输入类型文本值附加到href laravel?
<a id= "lnk_audio_devices" href="{{route('search.products', ['category' => 'audio_devices',
@if(txt_product.value != '')
'products' => txt_product.value
@endif
])}}" >Audio Devices</a>
谢谢您的回答。也许是因为我想在我的href中使用'路由',这就是为什么我不能正确地使用它。我尝试你的代码,但问题是它总是将重定向到相同的链接不在所需的网址。我认为它是因为href =“”。第二个是如果URL中有参数,它总是得到它..所以我尝试修改你的代码。 – user3418036
这是我的新代码..function导航(类别){VAR = text_search的document.getElementById( '搜索')value.trim()。 text_search =(text_search =='')? '':'&product ='+ text_search; category ='?category ='+ category; var url = window.location.origin +'/'+ category + text_search; window.location.href = url; } – user3418036