PHP Web Developer.

กรกฎาคม 20, 2012

Disabled/Enabled Textbox by radio button use jquery

Filed under: Javascript & jquery — Prajak @ 1:46 pm

======= Code =======
<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js”></script&gt;
<script>
$(document).ready(function() {

// show Enabled textbox1
$(‘#rad1Enabled’).click(function(){
$(“#textbox1”).removeAttr(“disabled”);
});

// show Disabled textbox1
$(‘#rad1Disabled’).click(function(){
$(“#textbox1”).attr(“disabled”, “disabled”);
});
});
</script>
<span>
<input type=”radio” name=”rad1″ id=”rad1Disabled” value=”0″ checked=”checked” /> Disabled
<input type=”radio” name=”rad1″ id=”rad1Enabled” value=”1″ /> Enabled
</span>
<div>
<input type=”text” id=”textbox1″ name=”textbox1″ disabled=”disabled” />
</div>
======= End Code =======

ให้ความเห็น »

ยังไม่มีความเห็น

RSS feed for comments on this post. TrackBack URI

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s

บลอกที่ WordPress.com .

%d bloggers like this: