Search
 
SCRIPT & CODE EXAMPLE
 

HTML

javascript select option attribute

<select onchange="alert(this.options[this.selectedIndex].getAttribute('isred'));" name="myname" class="myclass"> 
    <option isred="-1" value="hi">click</option>
    <option isred="-5" value="hi">click</option>
</select>
Comment

javascript select option attribute

<select name="address" class="form-select" required onChange="getDistricts(this.options[this.selectedIndex].getAttribute('region_id'));">
  <option value="">-----------</option>
  @foreach($regions as $region)
  <option value="{{ $region->name_ru }}" {{ old('address', '') == $region->name_ru ? 'selected' : '' }} region_id="{{ $region->id }}">{{ $region->name_ru }}</option>
  @endforeach
</select>

<script>
  function getDistricts(region_id) {
      console.log(region_id);
  }
</script>

Comment

PREVIOUS NEXT
Code Example
Html :: fixed size body html 
Html :: font awesome css content not working 
Html :: a go to section 
Html :: png favicon 
Html :: hambuerger button svg 
Html :: html tab character tag 
Html :: html local image 
Html :: what is spread in trading 
Html :: html qr code generator 
Html :: select option default value 
Html :: get image from google drive 
Html :: embed recaptcha in html 
Html :: bootstrap news template 
Html :: html code contact form template 
Html :: open link as a number 
Html :: how to import popper.js 
Html :: how to add text in html 
Html :: show scrollbar only when scrolling 
Html :: membuat footer html 
Html :: how to add image in html 
Html :: change font size of h1 in html 
Html :: html a href tooltip 
Html :: block level elements 
Html :: HTML DOM innerText 
Html :: bootstrap switch change text 
Html :: google share link html 
Html :: ion input file 
Html :: html hyperlink 
Html :: invisible element html 
Html :: submit button out of from 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =