开发者

jQuery: how do I append variables onto a form path?

开发者 https://www.devze.com 2023-01-10 00:00 出处:网络
Lets say the URL in开发者_StackOverflow社区 my form is action=\"/medias/new_from_disk?CKEditor=content_body&CKEditorFuncNum=1&langCode=en\"

Lets say the URL in开发者_StackOverflow社区 my form is

action="/medias/new_from_disk?CKEditor=content_body&CKEditorFuncNum=1&langCode=en"

and the form has ID myform how would I conjure a jQuery command to add to the action

&var=value

?

complete form:

<form enctype="multipart/form-data"
       id="myform"
       method="POST" 
       action="/medias/new_from_disk?CKEditor=content_body&amp;CKEditorFuncNum=1&amp;langCode=en">
 </form>


Like this:

$('#myform').attr('action', $('#myform').attr('action') + '&var=value');

More Info:

  • http://api.jquery.com/attr/
0

精彩评论

暂无评论...
验证码 换一张
取 消