I am new to javascript any advice will be really much appreciated I am trying to hide my button and show it based in the value that been loaded to a field but my below code is not working
there is a field named ook if page loaded there will be a value display in ook it depends on the database but it will be loaded in page I want my button to hide if value is not yes
$(document).ready( function(){
var k = FormUtil.getField("ook").val();
if ( k ='YES') {
$("#btn).show();
} else { $("#btn).hide();
}
});
$(function(){}is missing a closing);#2) Yourelse {is missing a closing}. #3) Your$("#btn)is missing the"to make it correctly written as$("#btn")$(document).ready()and$(function(){})are effectively the same thing, so you are doing the same thing twice. You only need one of those, so pick which one you like better and remove the other.==instead of=to check equality