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/
精彩评论