Javascript examples for jQuery:String
JQuery Check if String is HTML Tag
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(window).load(function(){/*ww w .j a v a 2s . co m*/ var samples = ["<img src='#' alt='img1' />","hello","bye","<img src='#' alt='img2' />"]; for(var i = 0, len = samples.length; i < len; i++) { if($(samples[i]).length > 0) { console.log($(samples[i]).attr('alt')); } } }); </script> </head> <body> </body> </html>