Home > front end >  Multiple method to encapsulated into a click event
Multiple method to encapsulated into a click event

Time:12-23

The four methods have similarities, encapsulated into a? For bosses to help
I give every radio group set up a click event, as follows:
 
//archive ES set the click event
The function doWriteFileESText (obj) {
Var value=https://bbs.csdn.net/topics/$(" input [type='radio'] [name='FileES'] : checked "). The val ();
$(" # test1 "). The parent () [0]//return is dom node
Var parentDivId=obj. ParentNode. ParentNode. ParentNode. ParentNode. ParentNode. Id;
If (value=https://bbs.csdn.net/topics/="CUSTOM" & amp; & ParentDivId=="FileES") {
$(" # TextFileES "). The show ();
} else {
$(" # TextFileES "). Hide ();
$(" # TextFileES "). Val (" ");
}
}

//archive SQL Settings click event
The function doWriteFileSQLText (obj) {
Var value=https://bbs.csdn.net/topics/$(" input [type='radio'] [name='FileSQL'] : checked "). The val ();
Var parentDivId=obj. ParentNode. ParentNode. ParentNode. ParentNode. ParentNode. Id;
If (value=https://bbs.csdn.net/topics/="CUSTOM" & amp; & ParentDivId=="FileSQL") {
$(" # TextFileSQL "). The show ();
} else {
$(" # TextFileSQL "). Hide ();
$(" # TextFileSQL "). Val (" ");
}
}

//not archive ES set the click event
The function doWriteNotFileESText (obj) {
Var value=https://bbs.csdn.net/topics/$(" input [type='radio'] [name='NotFileES'] : checked "). The val ();
Var parentDivId=obj. ParentNode. ParentNode. ParentNode. ParentNode. ParentNode. Id;
If (value=https://bbs.csdn.net/topics/="CUSTOM" & amp; & ParentDivId=="NotFileES") {
$(" # TextNotFileES "). The show ();
} else {
$(" # TextNotFileES "). Hide ();
$(" # TextNotFileES "). Val (" ");
}
}

//not archive SQL Settings click event
The function doWriteNotFileSQLText (obj) {
Var value=https://bbs.csdn.net/topics/$(" input [type='radio'] [name='NotFileSQL'] : checked "). The val ();
Var parentDivId=obj. ParentNode. ParentNode. ParentNode. ParentNode. ParentNode. Id;
If (value=https://bbs.csdn.net/topics/="CUSTOM" & amp; & ParentDivId=="NotFileSQL") {
$(" # TextNotFileSQL "). The show ();
} else {
$(" # TextNotFileSQL "). Hide ();
$(" # TextNotFileSQL "). Val (" ");
}
}

  • Related