Will someone please tell me why the first snippet of code doesn't work and the second one does. Is it the issue of variable scoping or any other issue?
jQuery(document).ready(function($) {
var displayNo = $(".ue-show-success").css('display', 'none');
var displayYes = $(".ue-show-error").css('display', 'block');
$(".somebutton").on('click', function() {
displayNo;
displayYes.text('some text');
});
});
The above code doesn't work as expected. But below one does.
jQuery(document).ready(function($) {
$(".somebutton").on('click', function() {
$(".ue-show-success").css('display', 'none');
$(".ue-show-error").css('display', 'block').text('some text');
});
});
Thanks in advance