开发者

pass and set javascript variables as value on a get method

开发者 https://www.devze.com 2023-02-14 15:14 出处:网络
how do I call a javascript variable to be set as value on my get function? i have this co开发者_如何学运维de:

how do I call a javascript variable to be set as value on my get function?

i have this co开发者_如何学运维de:

<script type="text/javascript">
    var imagelinks = $('div[name=content] a');  
    idno = imagelinks.attr('idno');
</script>

and i want idno to be set as value of my input type in a get function. this is the code:

<form method="GET" action="action.php">
    <input id="i1" name="i1" value=" //this is where i want "idno" to be passed">
</form>

help pls!


Do you mean this:

$('#i1').val(idno);


<script type="text/javascript">
var imagelinks = $('div[name=content] a');  
idno = imagelinks.attr('idno');
document.getElementById('i1').value = idno;
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消