문제

I'm using Gravity form on my Wordpress site, Gravity form generate automatic form action, I was wondering if i can add a query at the end of each action.

This is default code which is generated

<form method='post' enctype='multipart/form-data'  id='gform_4'  action='/free-trial/'>

And i want to be like

<form method='post' enctype='multipart/form-data'  id='gform_4'  action='/free-trial/#testdiv'>

I searched and found lots of jquery or php code which was over my head, i just need a simple code.

Any help would be appreciated

도움이 되었습니까?

해결책

You could try getting the current form action value first, append the desired hash query then set the new value to the action attribute:

var url = $('#gform_4').attr('action') + '#testdiv';
$('form').get(0).setAttribute('action', url); 

JSFiddle

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top