开发者

jquery in html injection

For example I have 2 input's and one button with attribute, where i wanna use input values, it may be something like this:

<input data-link="test?input1=$('#input1'.val())&input2=$('input2.val()')开发者_开发知识库" />


--------------Mind reading mode on---------------------

You have;

<input id='input1' type='text'>
<input id='input2' type='text'>
<input id='input3' type='text'>
<button>Copy data</button>

$(document).ready(function(){
    $('button').click(function(){
        var string = "test?input1="+$('#input1').val()+"&input2="+$('#input2').val();
        $('#input3').data('link', string);
    });
});

fiddle here http://jsfiddle.net/bGTQJ/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜