Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
jquery val() contains()

I want to know if the textarea value contains a certain word. This is not working for me.

var value = $('#embedModal textarea').val();
if($(value).contains('iframe')){...
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Try javascript

if (value.indexOf('iframe') >= 0) {

JQuery contains is for DOM elements, not strings.

over 4 years ago · Santiago Trujillo Report

0

Try doing it like this:

$('#embedModal textarea:contains("iframe")').each(function() {
  //Do something
});

edit

Example

over 4 years ago · Santiago Trujillo Report

0

this works:

$.contains( document.documentElement, document.body ); // true

var babyEl = $('div#id');
var daddyEl = $('div#ID');

if($.contains(babyEl, daddyEl)) {
    //do fun stuff
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!