Jquery: alert() when submit with default value

how to put jquery script with message to change the default value for user (to the script below):

"<script>$(document).ready(function(){
alert ("helloworld");
});</script>"
<% if $display == 1 OR $_URL == $URL %>
	<script>$(document).ready(function(){$("#search").click(function(){$("#search_form").slideToggle("slow")})});</script>
	<script type="text/javascript">$(document).ready(function(){$("#bc").bind("change",function(){if(this.value=="1"){$("#c").attr("disabled",true)}else{$("#c").attr("disabled",false)}});$("#bc").change()});</script>
	<div id=search_form class='clear rel pad-left1 window<% if $display_show == '' %> none<% /if %>'>
	<form action=<% $URL %>catalogs/ method=GET name=searchform>
		<script>jQuery(function($){$("#t").Watermark("search\u00A0<% include file = $TPLx.'bl/if_search/index2.html' %>","#ccc")});</script>
			<input type=text name=t id=t size=54 />
			<% if $_URL == $URL %>
		  <select name=bc id=bc class=cc>
		  	<option value=''>&ndash;&nbsp;Select Category&nbsp;&ndash;</option>
		  	<% foreach from = $bc key = k  item = v %><option value=<% $bc[$k][id] %><% if $GET[bc] == $bc[$k][id] %> selected<% /if %>><% $bc[$k][t] %></option><% /foreach %>
		  </select>
		  <% /if %>
		  
			<select name=c id=c class=ccc<% if $_GET[0] == 'catalogs' OR $_GET[0] == '' %><% else %> disabled<% /if %>>
				<option value=''>&ndash; <% if $_GET[0] == 'catalogs' OR $_GET[0] == '' %><% else %>All&nbsp;<% /if %><% include file = $TPLx.'bl/if_search/index.html' %>&nbsp;&ndash;</option>
				<% foreach from = $c  key = k  item = v %><option value=<% $c[$k][id] %><% if $GET[c] == $c[$k][id] %> selected<% /if %>><% $c[$k][t] %></option><% /foreach %>
			</select>
			<a href=# onclick=document.searchform.submit(); class='fg-button button-small ui-state-default fg-button-icon-right ui-corner-all'>search</a>&nbsp; <a href=#>advanced search</a><br />
			<span class='bold'>Your recent searches:</span>&nbsp; <span class=dsc>none</span> <a href=#>AA</a>, <a href=#>ethanol</a>
	</form>
	</div>
	<% /if %>

Open in new window

AndyPSVAsked:
Who is Participating?
 
mstrelanCommented:
Store the defaults in a javascript array. Then onsubmit test each input against its default value until you get a mismatch. At that point alert the user and return false.

Is that what you're wanting to do?
0
 
AndyPSVAuthor Commented:
Yes, could you give me the javascript code?
0
 
AndyPSVAuthor Commented:
answer not needed, thanks btw
0
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.