most reusable code for submit-on-select with JQuery datepicker -


there seem (at least) 2 ways make jquery datepicker submit when date selected. firstly,

onselect : function (datetext, inst) { $('#myformid').submit(); } 

from

post form on select jquery datepick

or

datepicker submit form when select date

the drawback embeds id of form, if copy code of existing datepicker , overlook this, won't work; if don't overlook it, changing id still 1 more thing do.

so, version

onselect : function() { $(this).parent('form').submit(); } 

looks better can copied without need amendment. however, if datepicker associated textbox, , textbox inside table, won't work , line required instead

onselect : function() { $(this).parents('form').submit(); } 

(see jquery datepicker won't submit inside table)

the difference - in case it's not obvious - 'parents' not 'parent'.

i've tried using 'parents' datepickers, , seem work fine - recommended way submit-on-select (e.g. https://forum.jquery.com/topic/datepicker-onselect-submit-date non-so example). know circumstance in

onselect : function() { $(this).parents('form').submit(); } 

would not submit-on-select, or in fact best , readily reusable option?


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -