php


I want to disable the options when once selected - laravel


I am creating dynamic Dropdown list where the options are coming from database.
When once selected a option it should get disable in next selection and should get enable when selection removed.
Here is my select tag which is a laravel code.
<div class="form-group">
<label for="category">Category</label>
{{
Form::select('category',(isset($data) && isset($data['kra_category'])) ? $data['kra_category'] : [],
htmlSelect('category',$data),
array('name'=>'kra[0][category]', 'data-name' => 'category', 'class' => 'form-control chosen-select kra_category', 'placeholder' => '', 'data-placeholder' => 'Select Category'))
}}
</div>
And here is my jQuery function...
The function is yet to be created.
$('.chosen-select').change(function() {
var value = $(this).val();
});
Write this function..
$(".chosen-select").change(function(){
var value = $(".chosen-select option:selected").val();
var theDiv = $(".is" + value);
$(".chosen-select option:selected").hide().siblings().removeProp('disabled');
});
$('#test').change(function () {
var indexOfSelect = $(this).find('option:selected');
$(this).find('option').removeAttr('disabled');
//indexOfSelect.attr('disabled','disabled');
indexOfSelect.prop('disabled', 'false');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select id="test">
<option value="">Select</option>
<option>AA</option>
<option>BB</option>
<option>CC</option>
<option>DD</option>
</select>

Related Links

How to return output on the same page ajax php
PHP regex phone validation not working
HHVM explode() limit issue
Laravel 5.4, show error message auth login when user not active
Can '#' prevent error from being caught by 'set_error_handler()' in PHP?
PHP - variables don't change value when they should
Encryption with Node Crypto - Decryption with PHP openssl_decrypt fails
API integration in Codeigniter application
How to call 2 Functions at the same time using Twig AJAX Form?
get the timespent from datetime from current row to the next row mysql
cannot redirect after mysqli connection error
How to structure new website while preserving the current one?
Telnet, Connection To Hotmail & Gmail Fails
Change PHP Variable to Lowercase
php save a file as bin will write to many 0000
Php, is it possible to get the name of the program calling my script

Categories

HOME
python-2.7
generics
biztalk
autocomplete
cryptography
fogbugz
position
u-boot
pyresttest
cisco
cocotb
circleci
tiff
orc
createjs
sslhandshakeexception
spring-jpa
orange-api
synthesis
vmware-workstation
uima
gravity
boomi
jest
neo4j.rb
liferay-6.2
intel
substring
tortoisemerge
beego
hevc
gravity-forms-plugin
unmarshalling
windowsiot
rust-cargo
fotorama
express-session
dreamfactory
keyboard-layout
flowchart
classnotfoundexception
distributed-caching
virtual-memory
transparency
asihttprequest
sony-future-lab-n
cordova-ios
amazon-elastic-beanstalk
renderman
patternlab.io
mechanicalturk
mathjs
dmarc
django-testing
meld
apache-pig-grunt
ioctl
ajax4jsf
self
asp.net-web-api-helppages
bjam
replicaset
scala-swing
tidyr
ssmtp
mutators
createfile
hp-idol-ondemand
dnsjava
utf8-decode
object-code
oracle-adf-mobile
wso2bam
django-sites
armv6
compiler-flags
boinc
yii-booster
notin
background-thread
icenium
getproperty
getopt-long
fitch-proofs
microblogging
background-repeat
mvcrecaptcha
botnet
space-partitioning
nosetests
azure-acs
photo-management
simile
servlet-container
eaccelerator
pinax
android-input-method
facebook-fbml
rational-unified-process
comment-conventions
community-server

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile