Show DIV when form is submitted


I would like to get a DIV to come up when a user clicks the form submit button (SEARCH) on this page.  

I have tried, using this code, but it doesn't seem to work (the page works normally but no DIV pops up):

<input name="searchlocationsrentals" id="searchlocationsrentals" type="submit" class="bindexbuyrent-long" value="SEARCH NOW" align="top" onmouseover="'pointer'" onclick="document.getElementById('holdpage').style.visibility='block'"/>

Open in new window

Help appreciated!  Thanks in advance.
Who is Participating?
Kim WalkerConnect With a Mentor Web Programmer/TechnicianCommented:
This will not prevent the form from submitting. Do you have an onsubmit event listener on the form element to prevent this? If so, you may be looking for (display instead of visibility):
<input name="searchlocationsrentals" id="searchlocationsrentals" type="submit" 
	class="bindexbuyrent-long" value="SEARCH NOW" align="top" 

Open in new window

try this

if still no okay, try zIndex to set the div on most top of body page


If still in issue, go to chrome browser options-->tools-->developer tools-console
to see and fix all javascript syntax error  and send us those error

Hope understand your question completely, if not, please pt it out

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
The code works stand alone as you can see by the sample,output

<!DOCTYPE html>
    function showHide(divId){
    var theDiv = document.getElementById(divId);

  <meta charset="utf-8">
  <title>JS Bin</title>
  <div id="hidethis" style="display:none">Now you see me</div>
  <button onclick="showHide('hidethis');">Click me</button>

Open in new window

I see you have this code
<script type="text/javascript" src="deps/hideshow.js"></script>

Open in new window

script type="text/javascript">//<![CDATA[
				  inputField : "f_date1",
		          trigger    : "f_btn1",
//		          onSelect   : function() { this.hide(); document.forms['form1'].submit() },
		          onSelect   : function() { this.hide()},				  		          //showTime   : 12,
				  min: 20140407,
				  max: 20150707,
				  fdow: 6,
		          dateFormat : "%d-%b-%Y"

Open in new window

Could one of these be interfering?   I also can see an error pop up in the console when you click the search button.
7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

You can see the difference between display and visibility from the link

and select which one from display or visibility   css style you want

Kim WalkerWeb Programmer/TechnicianCommented:
Duh. I didn't notice you had a link to your page. The absence of any value in the action attribute of the form element causes the page to refresh when the submit button is activated. This would cause the element with ID of "holdpage" to return to its default display or visibility. HOWEVER, I can't find an element with ID of "holdpage". Am I missing something?
Nico2011Author Commented:
thanks - this worked
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.