0

I have a textbox with id main_category_lan1 as below.

<input type="text" name="main_category_lan1" id="main_category_lan1" Value="Hello"> 

And I have a link in the same page as below.

<a href="javascript: void(0)" onclick="popup('http://translate.google.com/#en/ta/'+document.getElementById('main_category_lan1').value"> Translator </a> 

I want to append the textbox value to the "Onclick link" while clicking the link...

Expected output onclick is ,

<a href="javascript: void(0)" onclick="popup('http://translate.google.com/#en/ta/Hello').value"> Translator </a> 
1
  • Based on what I see you want that your user enter the text in your input and then on click you pass the words to translate to google with GET and then you want to show the result of that translation on your same textfield? Commented Nov 8, 2013 at 20:51

2 Answers 2

1

You forgot the closing parenthesis in your onclick attribute. Also, did you mean to use window.open() instead of popup()? This works:

<a href="javascript: void(0)" onclick="window.open('http://translate.google.com/#en/ta/'+document.getElementById('main_category_lan1').value)"> Translator </a> 

http://jsfiddle.net/AXWr8/

Sign up to request clarification or add additional context in comments.

Comments

0

Try

function openLink() { window.open('http://translate.google.com/#en/ta/' + document.getElementById('main_category_lan1').value); } <a href="javascript: void(0)" onclick="openLink()">Translator</a> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.