Skip to content

Instantly share code, notes, and snippets.

@CB9TOIIIA
Created June 13, 2018 11:15
Show Gist options
  • Save CB9TOIIIA/971fea1870a03ff5352d86b8a53ac45c to your computer and use it in GitHub Desktop.
Save CB9TOIIIA/971fea1870a03ff5352d86b8a53ac45c to your computer and use it in GitHub Desktop.
Форма и select
<script>
jQuery(document).ready(function($) {
options = $("select[name=class-of-car]>option:first");
option = options.text();
var regex = /\d+.BYN/;
cenaselecta = regex.exec(option);
// alert(cenaselect);
$("#resultcena").text(cenaselecta);
jQuery('select[name=class-of-car]').change(function() {
var text = $("select[name=class-of-car] option:selected")[0];
var valprice = text.value;
// alert(valprice);
var regex = /\d+.BYN/;
cenaselect = regex.exec(valprice);
// alert(cenaselect);
$("#resultcena").text(cenaselect);
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment