slj90 Posted December 11, 2014 Share Posted December 11, 2014 Usually it would be something like: $("#lblpasswordmessage").html("Password is too short"); But how do you do it using a variable? For example say the variable is called 'pwm'; $("#pwm").html("Password is too short"); $("pwm").html("Password is too short"); $(pwm).html("Password is too short"); Thanks Quote Link to comment https://forums.phpfreaks.com/topic/293018-changing-html-element-using-variable/ Share on other sites More sharing options...
Solution requinix Posted December 11, 2014 Solution Share Posted December 11, 2014 The third, if pwm contains "#lblpasswordmessage". Or if it doesn't include the hash sign then $("#" + pwm) Quote Link to comment https://forums.phpfreaks.com/topic/293018-changing-html-element-using-variable/#findComment-1499246 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.