开发者

Concatenate href value and jquery result in href of anchor tag

开发者 https://www.devze.com 2023-01-14 19:38 出处:网络
Below is my code present in my application : <input id=\"input\" value=\"Testing\" /> <ahref=\"/captures/getTranslation/?TB_iframe=true&amp;modal=true&amp;height=380&amp;width=6

Below is my code present in my application :

<input id="input" value="Testing" />

<a  href="/captures/getTranslation/?TB_iframe=true&amp;modal=true&amp;height=380&amp;width=670&amp;" name="Signup" id="signuplink" title="Post" > Test </a>

I am posting some data to one page, i am getting all the attached parameter in my result page.

Here i want to know how do i pass text value with href of anchor tag.

I tried something like this, but it's not working :

<a  href="/captures/getTranslation/?TB_iframe=true&amp;modal=true&amp;height=380&amp;width=670&amp;textBoxValue=$('#input').val();" name="Signup" id="signuplink" title="Post" > Test </a>

I have used overlay on onclick of anchor tag, if i add function over 开发者_StackOverflowthere then overlay wont come, due to that i m skipping function call on any events.

I am using jquery library also. But in result page i am not getting textBoxValue parameter.

Please suggest me guys, how to append parameter(input box value) in href attribute of achor tag using jquery

Thanks

-Pravin


Try changing the a to a button, or span and adding an onclick event, you can then redirect the users where ever you want with values from any element.

something like this:

<a  onclick="javascript:GoToUrl();"> Test </a>


<script type="javascript">

function GoToUrl()
{
var url = "/captures/getTranslation/?TB_iframe=true&amp;modal=true&amp;height=380&amp;width=670&amp;" + textBoxValue=$('#input').val();

window.location.href = url;
}

</script>
0

精彩评论

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