SOLVED - http://jsfiddle.net/dwebexperts/U4G8G/
Try this -
$("a.button").hide();
$(function() {
$('#selectbox').change(function(){
if ($('option:selected',$(this)).index() == '1') {
$("a.button.edit").show();
$("a.button.add").hide();
$("a.button.chkmenu").show();
$('input.pr').each(function() {
if($(this).val()==""){
$(this).prop("disabled", true);
}
if($(this).val()!=""){
$(this).prop("disabled", false);
}
});
} else if ($('option:selected',$(this)).index() == '2') {
$("a.button.edit").hide();
$("a.button.add").show();
$("a.button.chkmenu").show();
$('input.pr').each(function() {
if($(this).val()==""){
$(this).prop("disabled", false);
}
if($(this).val()!=""){
$(this).prop("disabled", true);
}
});
} else {
$("a.button.edit").hide();
$("a.button.add").hide();
$("a.button.chkmenu").hide();
$('input.pr').each(function() {
$(this).prop("disabled", false);
});
}
});
});
############################################ ###################
http://jsfiddle.net/dwebexperts/U4G8G/
HTML JQUERY: -
HTML-:
<table>
<tr>
<td><input class="pr" id="1" value="pr" type="text" /></td>
<td><input name="checkbox[]" type="checkbox" id="checkbox[]" class="checkbox new1"/></td>
</tr>
<tr>
<td><input class="pr" id="2" type="text"/></td>
<td><input name="checkbox[]" type="checkbox" id="checkbox[]" class="checkbox new2"/></td>
</tr>
<tr>
<td><input class="pr" id="3" value="XYZ" type="text"/></td>
<td><input name="checkbox[]" type="checkbox" id="checkbox[]" class="checkbox new3"/></td>
</tr>
<tr>
<td><input class="pr" id="4" type="text"/></td>
<td><input name="checkbox[]" type="checkbox" id="checkbox[]" class="checkbox new4"/></td>
</tr>
<tr>
<td><input class="pr" id="5" type="text"/></td>
<td><input name="checkbox[]" type="checkbox" id="checkbox[]" class="checkbox new5"/></td>
</tr>
</table>
<select id="selectbox">
<option></option>
<option value="one">1</option>
<option value="two">2</option>
</select>
<a class="button add" style="cursor:pointer;"><span><b>Add Purchase Request</b></span></a>
<a class="button edit" style="cursor:pointer;"><span><b>Edit Purchase Request</b></span></a>
<a class="button remove" style="cursor:pointer;" name="remove"><span><b>Remove Purchase Request</b></span></a>
<a href="javascript:setCheckboxes3(true);" class="button chkmenu"><span><b>Check All</b></span></a>
<a href="javascript:setCheckboxes3(false);" class="button chkmenu"><span><b>Uncheck All</b></span></a>
: -
$("a.button").hide();
$(function() {
$('#selectbox').change(function(){
if ($('option:selected',$(this)).index() == '1') {
$("a.button.edit").show();
$("a.button.add").hide();
$("a.button.chkmenu").show();
$('input.pr').each(function() {
if($(this).val()==""){
var inputid = $(this).attr("id");
$(".new"+inputid).prop("disabled", true);
}
if($(this).val()!=""){
var inputid = $(this).attr("id");
$(".new"+inputid).prop("disabled", false);
}
});
} else if ($('option:selected',$(this)).index() == '2') {
$("a.button.edit").hide();
$("a.button.add").show();
$("a.button.chkmenu").show();
$('input.pr').each(function() {
if($(this).val()==""){
var inputid = $(this).attr("id");
$(".new"+inputid).prop("disabled", false);
}
if($(this).val()!=""){
var inputid = $(this).attr("id");
$(".new"+inputid).prop("disabled", true);
}
});
} else {
$("a.button.edit").hide();
$("a.button.add").hide();
$("a.button.chkmenu").hide();
$('input.pr').each(function() {
$("input[type=checkbox]").prop("disabled", false);
});
}
});
});