I want to set .focus();
on specific <div>
on user action. This action will reload the page and after reload I want to set focus this <div>
.
NOTE: I could have added HTML but thought screen shot will be much easier.
Following is my HTML structure:
I tried following but none of these works:
//option - 1
$(".cart-panel .pickup-delivery-time .cart-msg").focus();
//option - 2
$(".pickup-delivery-time .later").find(".cart-msg").focus();
//option - 3
window.location.hash = '.cart-msg';
Full Code:
$(document).on("click", "#map-delivery-addresses button", function() {
$.publish('delivery_address_selected', { address: this });
if (!$(".cart-msg").is(":focus")) {
$(".cart-panel .pickup-delivery-time .cart-msg").focus();
}
});
What am I missing here?