I am working in Django and populated the labels of the forms . Then I need one Field which is the "country" to be read only so that no one can edit that . I applied the following code but its not working . can some one help ?
jQuery12(".input_id_shipping_detail_country label").replaceWith("*Country");
This one is for replacing the label its working fine
<script>
jQuery1 = jQuery.noConflict();
jQuery1(window).load(function () {
jQuery1("#id_billing_detail_country").val('Mexico');
});
</script>
{% else %}
<script>
jQuery1 = jQuery.noConflict();
jQuery1(window).load(function () {
jQuery1("#id_billing_detail_country").val('United States');
});
</script>
This is for the default value load at onload function of window .
country(document).ready(function()
{
country('#id_billing_detail_country')
.replaceWith(country('#id_billing_detail_country')
.clone().attr('readonly', 'readonly'));
country('#id_shipping_detail_country')
.replaceWith(country('#id_shipping_detail_country')
.clone().attr('readonly', 'readonly'));
country("#id_billing_detail_country").css("border", "none");
country("#id_shipping_detail_country").css("border", "none");
Now this is the code where I applied the read-only thing its not working .
I have tried .prop
instead of .attr
as well.