simplifying my code, I'm reloading my page with some data that I get from the user (passing it to the url), but once the page gets reloaded, I need to change the input box's placeholder. here is my html:
<div id="someId">
<input type="text" name="date_chosen" id="date_chosen" placeholder="Select Date">
</div>
This jQuery code does the job (changing placeholder) if there is no page reloading:
<script>
$(function() {
$("#date_chosen").on("click", function(e) {
location.href = "<same_url>" + "<user_input>"; //in the actual code I'm redirecting users to the same page after processing their input from the input box
$('#date_chosen').attr("placeholder", "parameter from user");
})
});
</script>
if I do console.log($('#date_chosen').attr("placeholder")) right after where the attribute is being changed, I see that the placeholder has changed after the reload, but page still shows the old placeholder, and I think it's because of another jquery initialization (can't explain it). What is the solution?