get a value from a serialized string
11,843
You don't need jQuery at all. Just do this:
$('#frmEditTab').submit(function(e){
e.preventDefault();
var title = this.title; //get the input named "title" of the form
alert(title.value); //alerts the value of that input
});
Author by
Prasad N
Updated on June 15, 2022Comments
-
Prasad N almost 2 years
There is a form, and on submit, I convert it to a serialized string to in order to submit the form via ajax.
var data = $$.serialize();
Now there is an input field named 'title' and I want to get its value to show a message. So I am looking for a method to do just that. I've tried;
alert(data.name);
But found out it's not the method.
UPDATE
Here is the fiddle: http://jsfiddle.net/wHBYK/
-
Niccolò Campolungo almost 11 yearsIf you want, you can also use only Vanilla JS, no jQuery. It's just changing few lines of code