I am trying to generate a link (preferably a button) that is generated dynamically with the content of an input, I think I have gone far by modifying jquery codes.
The link I want is a url like this: "index.php? order_of_purchase=" to which a number "index.php? order_of_purchase = 900" is concatenated
var $el = $("#url"),
url = $el.val();
var $orden_de_compra = $("#orden_de_compra"),
url2 = $orden_de_compra.val();
$el.replaceWith( $("<a />").attr({"href" : url+url2,"target":"_blank"}).html("Buscar") );
$("#orden_de_compra").change( function(){
var $el = $("#url"),
url = $el.val();
var $orden_de_compra = $("#orden_de_compra"),
url2 = $orden_de_compra.val();
$el.replaceWith( $("<a />").attr({"href" : url+url2,"target":"_blank"}).html("Buscar") );
});
<input type="text" id="orden_de_compra" placeholder="Orden de compra">
<input type="text" value="index.php?orden_de_compra=" id="url">