So, I have the following js markup:
jQuery(document).on( 'click', '.rhpcon', function(e) {
var rhp_name = jQuery(this).find('.rhi').data("name");
var my_html = '<div class="rhfi">'+ rhp_name +'</div>';
my_html += '<div class="something">Show something else</div>';
jQuery('.rh_pop').html(my_html);
});
As you can see, the rhp_name variable is used in the hardcoded html.
However, there are scenarios where data-name does not exist (ie, no rhp_name variable).
In a scenario where there is no rhp_name variable, I don't want the first my_html line to be used.
How do I check if the var is empty and so on?
Thanks!