<form id="search-form" action="#" method="post" style="float: left">
<div id="search-input" style="float: left; margin-left: 10px;">
<input type="text" name="search-terms" id="search-terms" placeholder="Search websites and categories..." style="width: 300px;">
</div>
<div id="search-label" style="float: left; margin-right: 10px;">
<button type="submit" onclick="searchbox()" for="search-terms" id="search-button" class="glyphicon glyphicon-search"></button>
</div>
</form>
When the user clicks on div id search-label
, I have implemented a function to toggle the display property of div search-input
. The code is working fine as expected.
function searchbox(){
if ($("#search-input").css('display') == 'none') {
$('#search-input').css('display','block');
} else {
$('#search-input').css('display','none');
}
}
I am facing an issue with submitting the form data via POST. The functionality does not work when pressing enter key or clicking the submit button.
If you have any suggestions or solutions, please assist me in resolving this issue. Thank you!