line 1:
line 2:
Your question is all over the place - the question / HTML / JavaScript dont match up .... below is a way to update the href
and text of an anchor
(not a div
) on the click of a button
<input id="Text1" type="text" /><input id="Button1" type="button" value="button" /><br />
<a id="Link1" target="_blank" href="http://search.twitter.com/search?q=#msdhoni">#msdhoni</a>
JavaScript :
$('#Button1').click(function() {
$('#Link1').attr('href',"http://search.twitter.com/search?q=#" + $('#Text1').val());
$('#Link1').text("#" + $('#Text1').val());
});
Note: You need to add an ID
to the anchor to make this code work