jquery select() method


  Translation results:

select

UK[sɪˈlekt] US[sɪˈlɛkt]

vt.Select; select; select

adj. Selected; select come out; be selective; be picky, picky

jquery select() methodsyntax

Function:When the text in the textarea or input element of text type is selected, the select event occurs. The select() method triggers a select event, or specifies a function to run when a select event occurs.

Trigger select event syntax: $(selector).select()

Bind the function to the select event syntax: $ (selector).select(function)

Parameters:

ParametersDescription
function Optional. Specifies the function to be run when a select event occurs.

jquery select() methodexample

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("input").select(function(){
    $("input").after(" Text marked!");
  });
});
</script>
</head>
<body>
<input type="text" name="FirstName" value="Hello World" />
<p>请试着选取输入域中的文本,看看会发生什么。</p>
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

Home

Videos

Q&A