I want get of name old input (Input 1) and add it with a change to new name input (Input 2).
DEMO: http://jsfiddle.net/F8SLR/
EX : i have this name: typeservice[] and i get it and change to: typeservice_un[]
I try as:
html:
<input type="text" name="typeservice[]" value="Input 1" id="000">
<input type="submit" value="CLICK ME" class="Chng">
<br>
<input type="text" name="" value="Input 2" id="111">
js:
$(document).on('click','.Chng', function(e){
e.preventDefault();
var name = $('#000').attr('name');
alert(name+'_un[]')
//$('#111').attr('name',name+'_un[]');
})
What do i do?