sasikala's blog

JQuery : How to enable / disable the text boxes based on radio button selection?

Edit
View

Insurance Name :

Insurance Cost :

Insurance Coverage :



Code Snippet:
<input type="radio" id="id_type_edit" name="type" value="Edit" />Edit
<input type="radio" id="id_type_view" name="type" value="View" />View

Insurance Name : <input type="text" id="id_ins_name" name="ins_name" value="AIG" disabled="disabled" /><br/>
Insurance Cost : <input type="text" id="id_ins_cost" name="ins_cost" value="1000" disabled="disabled" /><br/>
Insurance Coverage : <input type="text" id="id_ins_coverage" name="ins_coverage" value="60%" disabled="disabled" /><br/>

<script>
$(document).ready(function(){

$("#id_type_edit").click(function() {
$("[id*=id_ins_]").each(function(){
$(this).removeAttr("disabled");
});
});
$("#id_type_view").click(function() {
$("[id*=id_ins_]").each(function(){
$(this).attr("disabled",true);

});
});
});
</script>

How to include the scrollbar to the div tag?

If you want to display the large data inside div. If those cases need to include scrollbar. If the content beyond its height then veritial scrollbar will be shown.If it too wide then horizontal scrollbar will appear.

Include overflow:auto style to display the scrollbar.

<div id="id_news" style="width:200px;height:300px;overflow:auto">
</div>

jQueryhow to add and remove class?

Use addClass to add css class to the element.

$("#check_all").addClass("hidden");

removeClass used to remove css class attached with the element.

$("#check_all").removeClass("hidden");

JQuery - How to remove the , in the number format?

$rupees = $rupees.replace(/,/g,'');
g is used to remove all the occurance of , in the number format.

How to remove line break in perl?

$line =~s/\n//g;

s - search and replace
\n - line break
g- replace all the occurrence of \n

MySQL - How to set password for the root

Go to MySQL bin directory and use mysqladmin command to set password

mysqladmin -u root password sasikala

then login as

mysql -u root -psasikala

To change the root password

mysqladmin -u root -pold_password password new_password

The new password will be set to the root user.

Syndicate content