1 year ago

how to show and hide content using select dropdown box with jquery

Posted 1 year ago by icelander

helo. pls I want to show various content for various selected content; brake problems for brake category selected, engine problems for engine category, etc. but this code only shows the problems for the last category selected. below is the code.

Select Category Select Category @foreach($category as $sel) {{$sel->category}} @endforeach @foreach($products->chunk(3) as $productChunk)

Add Vehicle Problems under this category

@foreach($productChunk as $product)

{{$product->description}} N{{$product->price}}

below is the javascript code;

function fun_showtextbox(){ var select_status =$('#categorys').val(); if(select_status == {{$sel->id}} ){ $('#problems').show(); }else{ $('#problems').hide();} }

Please sign in or create an account to participate in this conversation.