How would I use $(this) instead of the full selector in the code below in the “if” statement. I tried a few different combination of “this” usage and none worked. Among them are…
if ($("this :selected").text().indexOf("[Subtract") >= 0){
if ($(this" :selected").text().indexOf("[Subtract") >= 0){
I am sure its gotta be something really simple, I just cannot figure it out today.
<script type="text/javascript" language="javascript">
$(document).ready(function(){
$("select[name^=SELECT___]").change(function() {
if ($("select[name^=SELECT___] :selected").text().indexOf("[Subtract") >= 0){
alert('');
}
});
});
</script>
Use the
findmethod on$(this)to find specific elements that are descendants ofthis: