I'm rendering some HTML in which I inject the value of a textbox with javascript. See: {$T.blob.title}
<input type="text" maxlength="40" size="16" id='imgtitle_{$T.blob.Id}' value='{$T.blob.title}' class="imagetitleinput" /><br />
However, this string may be null so the textbox shows the value "null"
to the visitor.
How can I check (preferably inline) if the value of {$T.blob.title}
is null
and if so set the value of this textbox to ""
?
I'm using this template engine: http://jtemplates.tpython.com/
This should work [Using Jquery]
$(document).ready(function () {
$(".imagetitleinput").each(function () {
if($.trim($(this).val()) == '') {
$(this).val('NULL');
}
});
})
Though not sure if you want to use Jquery here or not.