IT/제이쿼리

제이쿼리 jQuery( ":button" )

조원태 2017. 8. 9. 13:04
반응형

제이쿼리 jQuery( ":button" )


설명 : 버튼 요소의 모든 요소와 버튼 유형의 요소를 선택합니다.


$( ":button" )유효한 CSS 를 사용 하는 것과 동일한 선택자가 $( "button, input[type='button']" )있습니다


<!doctype html>

<html lang="en">

<head>

  <meta charset="utf-8">

  <title>button demo</title>

  <style>

  textarea {

    height: 35px;

  }

  div {

    color: red;

  }

  fieldset {

    margin: 0;

    padding: 0;

    border-width: 0;

  }

  .marked {

    background-color: yellow;

    border: 3px red solid;

  }

  </style>

  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>

</head>

<body>

 

<form>

  <fieldset>

    <input type="button" value="Input Button">

    <input type="checkbox">

 

    <input type="file">

    <input type="hidden">

    <input type="image">

 

    <input type="password">

    <input type="radio">

    <input type="reset">

 

    <input type="submit">

    <input type="text">

    <select>

      <option>Option</option>

    </select>

 

    <textarea></textarea>

    <button>Button</button>

  </fieldset>

</form>

 

<div></div>

 

<script>

var input = $( ":button" ).addClass( "marked" );

$( "div" ).text( "For this type jQuery found " + input.length + "." );

// Prevent the form from submitting

$( "form" ).submit(function( event ) {

  event.preventDefault();

});

</script>

 

</body>

</html>



반응형