I have a button which creates an input like a simple todo list which gives the default value of ‘This is the text.’ Instead, I want to replace the default text with the value of <input type="text" class="addnewinput">
The input which is created is after the .button is pressed is: $('<input type="text">').val().
$(".button").click(function (e) {
$.get("ajax.php",{'action':'new','text':'This is the text'},function(msg){
$('<input type="text">').val();
});
e.preventDefault();
});
So basically I want the value of this: <input type="text" class="addnewinput"> to be the value of this: $('<input type="text">').val() after the .button is pressed.
OR, it will be much better if I can give the value of .addnewinput from the beginning as such:
I tried this for test:
var abcdefg = $('<input type="text">').val('text')
$.get("ajax.php",{'action':'new','text': abcdefg() },function(msg){
$(msg).hide().appendTo('.todoList').fadeIn();
});
e.preventDefault();
}
});
but it doesn’t work
Hope someone can help me.
Thanks alot
To get the
valueof any input box you just have to sayI think you are looking for something like this