Monday, 18 September 2017

Get value from hidden field - jQuery

How can I get the value using jQuery?

<input type="hidden" value="" id='h_v' class='h_v'>

Use val() instead of text() var hv = $('#h_v').val(); alert(hv);

Wednesday, 6 September 2017

Check Null with ternary operator

At its most basic, the ternary operator, also known as the conditional operator, can be used as an alternative to the Java if/then/else syntax, but it goes beyond that, and can even be used on the right hand side of Java statements.


Example:-

<c:out value="<%=item.getMiddleName()!=null?item.getFirstName()+' '+item.getMiddleName()+' '+item.getLastName():item.getFirstName()+' '+item.getLastName()%>"></c:out>