Is there a better way to write this. I’m checking the input of a textarea and trying to find if it contains an object or iframe tags, if not then set var x =1
if ($textareaval.find('iframe').length > 0) {
alert('iframe')
} else if ($textareaval.find('param').length > 0) {
alert('object')
} else {
var x = 1;
alert(x)
If you don’t care which one it has you could combine the two checks into one:
Edit: You say you do care, though, so then no. Your code is fine, no improvement needed.