Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Add url to textfield Re: Add url to textfield

#66453
asp
Participant

This is how the php displays the URL’s that can be chosen. The point is that when the user clicks on the image the jquery adds the files_URL to a regular text box.

while($row = mysql_fetch_array($result))
{
echo ‘<div class="row" id="’ . $row .’">’;
echo ‘<h5>’ . $row . ‘ ‘ . $row . ‘ ‘ . $row . ‘ kb’;
echo ‘<a href="#"><img id="add" src="/Bilder/legg_til.png" /></a><a id="URL" href="/nyheter’ . $row . ‘">Prewiev</a></h5>’;
echo ‘</div>’;
}

I also tryed to make somthing with jQuery

$(document).redy(function() {
var url = document.getElementById("URL").value;
$("#add").click( function() {
$("#textbox").append(url);
});
});

This dident work 8-)

I also found somthing at the internet

function ChgText()
{
var MyElement = document.getElementById("MyTextBox");
MyElement.value = "If you see this, it worked!";

return true;
}

I got this to work, but not when trying to implement it with the php stuff.

I hope this helps :D