Submitting a Form using Jquery -
okay converting code jquery , js changing focus button target id using whenever press enter or double click in <select>
tag. document.getelementbyid.focus()
, document.getelementbyid.click()
, returning true submit form. looking example on how same thing using jquery instead. understand there .keypress()
, .dblclick()
function in jquery , thats think should using passing values of input box or select values little difficult since there multiples of each in form. fyi search page sends sql oracle database. update-
$(document).ready(function(){ $('form').submit(function(){ $(this).keypress() if(event.which ==13){ } }); });
this have far not sure if on right track or not. here example of how form is.
<form> <tr> <td nowrap="nowrap"><b> search number </b></td> <td style="vertical-align:top"><input type="text" name="revisor_number" value=revisor_number>" size="55" maxlength="100" /><br/><span style="font-size:75%">commas between numbers (10,15,20), dash range(10-20)</span><br/></td> <td> <input type="submit" name="submit_number" id="submit_number" value="go"/></td> </tr> <tr> <td style="vertical-align:top" nowrap="nowrap"><b> search type </b></td> <td> <select name="subtype[]" size="3" multiple="multiple" onkeypress="keypress(event, 'submit_subtype');" ondblclick="keypress(event, 'submit_subtype');"> <option value="">>--- ---</option> <td style="vertical-align:top"> <input type="submit" name="submit_subtype" id="submit_subtype" value="go"/></td>
you need move outside of submit function, replace with:
$('input, textarea').keypress(function(e) { if(e.which == 13) { $(this).blur(); $('#submit').focus().click(); } });
assuming '#submit' id of button.
Comments
Post a Comment