OK... I have a few input buttons per page:

<input type="button" value="MyButton" onclick="location='http://
www.mysite.com/xxx.html'">

I want to convert them to:
<a href="http://www.mysite.com/xxx.html";>MyButton</a>

How can I convert that with jquery? I try to get the onlick val but
jquery or javascript seems to convert onclick to a function.

I have this, but it's not quite right, I'm trying to just move the
onclick data to the link, but I'd rather do it with href.

$(":button").each(function(){
        var ocval = $(this).attr("onclick").val();
        $(this).replaceWith("<a class=\"button\" href=\"javascript:void(0);\"
onclick=\""+ ocval  +"\"><span>" + $(this).val() + "</span></a>");
});

Reply via email to