Here is my simple code:
function save_edit(res,table_color)
开发者_开发知识库 {
var the_form="details_"+res;
alert(document.the_form.title.value);
}
All I want to do is dynamically put the form from which to fetch the value of "title", but the above code is throwing a syntax error.
How do I do it?
This may be what you want
document[the_form].title.value
But I recommend you look in to getElementById
and more importantly, jQuery. IN jQuery you might say:
$('form#details_' + res).find('#title').val();
To achieve the same thing.
精彩评论