Sunday, 29 September 2013

Iterated TextArea in HTML which is changed and empty

Iterated TextArea in HTML which is changed and empty

I have a list of TextArea loop by forEach of JSTL, just like this:
<c:forEach var="test" items="${data}">
<td><textarea class="no-resize" name="submit-${test}"></textarea></td>
</c:forEach>
I want to know which TextArea is changed and if it empty when a button is
clicked using JQuery
The button is just like this
<button class="btn " type="submit" form="controller" name="save"
value="save" id="save" onClick="return onSave()">Save</button>
Here's what i tried so far:
function onSave()
{
$('.no-resize1').each(function(){
$(this).change(function(){
if(!$(this).val() == ''){
return true;
} else {
return false;
}
});
});
};
What am i doing wrong?

No comments:

Post a Comment