Skip to main content

multiple attribute selector in jquery

Here is the requirement to select all element that has attribute name and id  and both end with 'man'

Here is the code :

  <input id="man-news" name="man-news">
        <input name="milkman">
        <input id="letterman" name="new-letterman">
        <input name="newmilk">

and jquery for this is :

<script type="text/javascript">
        $(document).ready(function () {       
            $("input[id][name$='man']").val("I end with man kyword");
        });
    </script>

Done :)

Comments